When I was thinking which to choose JTextField or JFormattedTextField I thought that it would be much easier to program JFormattedTextField, it's name says that, too but now I am dealing with some problems. I consider that should be possible quickly to be done, but not here..
I have a
I would like to say:
1. inputLenght, not longer then for example 20.
2. Still I cannot use FormattedFactory, because of that initial value. setEditable, or setEnabled is not working in this case.
I feel that it is some trivial solution, or, I hope! So, any tips are welcome! Thank you!
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 25060
posted
0
Don't know. I presume you have looked for tutorials like this one?
I think this thread would sit better on our GUIs forum, so I shall move it.
Or perhaps all you need to do is use a standard JTextField and simply parse the textfield's text within a try/catch block, catching for NumberFormatException.
This message was edited 1 time. Last update was at by pete stein
Nicol Green
Ranch Hand
Joined: Jan 30, 2010
Posts: 66
posted
0
Yes definitely, JFormattedTextField was not the best option in my case. I will try what you proposed, and than tell you what was the best solution.