This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Color Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Color" Watch "Color" New topic
Author

Color

Jude Fawly
Ranch Hand

Joined: Dec 01, 2004
Posts: 33
Hi there,

I have a panel that includes a label. I've added a mouse listener on the label. This is how it is working now: when I click on the label, I reset the background color of the panel:

panel.setBackground(Color.PINK);

and then set it to another color:

panel.setBackground(new Color(30,100,10,40));

The problem is with the alpha component I am using with the color; now whenever I click on the label, the color of the panel is becoming darker and darker (the transparency of the color is reducing). Notice that the code panel.setBackground(Color.PINK) is working and i am sure of it.
I hope I made my point clear.

Waiting for any help.
Thanks.


Teach me to die that so I may<br />Rise glorious at the awful day
 
wood burning stoves
 
subject: Color
 
Similar Threads
Animation in Java
how to use rgb color values to set JPanel background color
labeled tabs across the top of a window
Still stuck-taking different approach plz help
JPanel