Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply 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
  • Quote
  • 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?
 
Alice Corman
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try using NumberFormat with the desired locale?

 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!