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.
1
Expert's answer
2012-12-19T11:20:30-0500
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:
https://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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS