• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JColorChooser white doesn't fire event

 
Con Lu
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been using a JColorChooser dialog which
sets the colors of a graph.
It seems to work except when choosing the color
white.
Debugging code to console shows that when choosing
white, ChangeEvents aren't fired, unlike other colors.
Any help would be much appreciated,
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic