Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
    Bookmark Topic Watch Topic
  • New Topic

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

 
A Khan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Report post to moderator
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?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Report post to moderator
"J Dummy,"

Welcome to JavaRanch!

Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names, with a first and a last name.

You can edit your display name here.

Thank you for your prompt attention, and enjoy the ranch!

-Marc
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Report post to moderator
And please don't crosspost. I'm closing this one, as the one in the Swing forum seems to be at the more appropriate place.
 
    Bookmark Topic Watch Topic
  • New Topic