File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JColorChooser white doesn't fire event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JColorChooser white doesn Watch "JColorChooser white doesn New topic

JColorChooser white doesn't fire event

Con Lu
Ranch Hand

Joined: Aug 27, 2002
Posts: 38
I have been using a JColorChooser dialog which
sets the colors of a graph.
It seems to work except when choosing the color
Debugging code to console shows that when choosing
white, ChangeEvents aren't fired, unlike other colors.
Any help would be much appreciated,
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

That's because white is the color that is initially selected and ChangeEvents are fired only when the selection changes. If white is already selected and you select it again, the selection does not change. Make sure you initialize the default color of the JColorChooser to the color of the component you are trying to change, something like :

Then the JColorChooser and the Graph will be synched up.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: JColorChooser white doesn't fire event
jQuery in Action, 3rd edition