Answer to Question #20870 in Java | JSP | JSF for Mike Balensiefer

Question #20870
I am trying to restrict character input in an option dialogue box. ref: http://www.roseindia.net/tutorial/java/swing/joptionpaneValidation.html The code shown limits the string values that can be input. (it can't keep you from entering a restricted value, it only alerts you to the entry.) I am trying to get this code to work with a DOUBLE value. So far I've been unsuccessful. Please help.
Expert's answer
Anything entered in a JOptionPane is stored as a string inJava.
When using "JOptionPane.showInputDialog" you canonly check the result of the input.
If it is not satisfied, re-query input.
Or you can use JTextField (allows the use of any filters onthe input.)
More details here:
http://docs.oracle.com/javase/1.4.2/docs/api/javax/swing/JTextField.html

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal