| Author |
Difference between JFormatterTextField and JTextField
|
Avani Joshi
Greenhorn
Joined: Jul 09, 2007
Posts: 13
|
|
Hi, Can anyone please tell me the differnce between calling a setDocument method using JFormatterTextField and calling setDocument method using JTextField. - Thanks in advance
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
A JFormattedTextField has, as the name implies, a format for the text to be filled in. A JTextField can have any text filled in. Usually you use JTextField. Only use JFormattedTextField if you need the input to have a specific format, e.g. phone numbers, (___) ____
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Brian Cole
Author
Ranch Hand
Joined: Sep 20, 2005
Posts: 852
|
|
JFormattedTextField differs from JTextField in that it can support locale-specific displayrestrictions on its valueediting non-Strings [via setValue(Object)/getValue()]incrementing/decrementing from the keyboard But you ask about specifically about setDocument(), which behaves about the same. I'd say that it's rare to call setDocument() on a JFormattedTextField. Usually one would call setValue() instead, and let the field (and its formatter) manage the Document for you. [ October 03, 2008: Message edited by: Brian Cole ]
|
bitguru blog
|
 |
 |
|
|
subject: Difference between JFormatterTextField and JTextField
|
|
|