Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

examples please

can anyone tell me how to make a swing component transparent to a specified level. i need some code thank you

  • 2
1 Solution
Mark RobertsIncident ManagerCommented:
To make a component transparent you would us the setBackground(color) method and pass it a color with the alpha set to the appropriate level of transparency.
Mark RobertsIncident ManagerCommented:

searchBtn = new JButton("Search");
searchBtn.setBackground(new Color(0,255,0,0));

This would create a JButton with it's color set to Green but with total transparency (not very useful since the button will actually end up being the same color as the component behind it).  Using values from 0 - 255 you can adjust the amount of transparency.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now