Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JColor Chooser Dialog

 
Manikandan Adaikkalavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am opening a Jcolor chooser dialog.i am getting user input from this one.
In this HSB Tabbed Pane, if i select radiobutton "H" and if i didn't enter any value and said OK.
Then i again opening dialog .i want to have value "0" if the user didn't entered any value in the
textfields in ("H" or "S" or "B").how to do this ???
Also have u ever noticed the following in the HSB Tabbed Pane
for "H" , the slider values ranges from 0 to 358.But here the user can enter value 359 in the text field .how to allow this? how to restrict the user not to enter the value 359.how to do this validation? Here the value from 360,361,362 etc are not allowed.
Similarly for "S" and "B".
any idea about how to solve this???
 
Manikandan Adaikkalavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any help ??
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only thing you should worry about getting from the JColorChooser is the Color that the user picked. Even if a user enters a value outside the range in one of the HSB text fields, it shouldn't matter, a valid color should still be generated. Also, it would be a bad idea to change the default behavior of the JColorChooser to zero out the textfields if the user doesn't enter anything... it would be confusing to the user... they would change the color by not entering a value, which would be confusing...

-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic