File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes How to stop Values being cleared JTextField in non-english locales Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to stop Values being cleared JTextField in non-english locales " Watch "How to stop Values being cleared JTextField in non-english locales " New topic
Author

How to stop Values being cleared JTextField in non-english locales

A Khan
Greenhorn

Joined: Jun 25, 2006
Posts: 2
--------------------------------------------------------------------------------
I have a textfield on which a float-based document model is applied such that insertString() is overloaded to check for Character.isDigit(). Character.OTHER_PUNCTUATION and Character.DASH_PUNCTUATION.

The above works fine except that I also have used DecimalFormat so that i can accept 8 decimal places. This logic fails when using a non-english locale such as German where a value like 12.34 is displayed as 12,34 which is rejected when I do a texfield.setText(). The textfield is set blank.

Can someone please suggest as to how should I go about so that value in textfield is not cleared when using German locales at same time I need to validate the enteries in the textfield?
Alice Corman
Greenhorn

Joined: Jun 21, 2006
Posts: 19
Did you try using NumberFormat with the desired locale?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to stop Values being cleared JTextField in non-english locales