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 JColor Chooser Dialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JColor Chooser Dialog" Watch "JColor Chooser Dialog" New topic

JColor Chooser Dialog

Manikandan Adaikkalavan
Ranch Hand

Joined: May 17, 2002
Posts: 35
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 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

Joined: May 17, 2002
Posts: 35
any help ??
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

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


Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: JColor Chooser Dialog
It's not a secret anymore!