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

x
  • 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

predikshon
0
Predikshon
Asked:
Predikshon
  • 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.
0
 
Mark RobertsIncident ManagerCommented:
example:

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.
0

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