File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java 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
JavaRanch » Java Forums » Java » Beginning Java
Reply locked 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?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

"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


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
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.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to stop Values being cleared JTextField in non-english locales
 
Similar Threads
Custom Locales?
Cleared Exam!
cleared scjp
cleared scjp
How to stop Values being cleared JTextField in non-english locales