Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with JTextField and comma of keyboard numeric

 
Tiago Sudeval
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have a problem when i enter a comma of keyboard numeric in JTextField, the JTextField show a square, but if i enter a comma of keyboard the JTextField show correct.

example:


What i need do ?


sorry my english
 
Brian Cole
Author
Ranch Hand
Posts: 924
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tiago Sudeval:
when i enter a comma of keyboard numeric in JTextField, the JTextField show a square, but if i enter a comma of keyboard the JTextField show correct.


This would seem to have something to do with keyboard mapping, either at the OS level or at the Java level. Does it still happen if you (temporarily) do java.util.Locale.setDefault(java.util.Locale.US) first thing in main()?

I can think of a couple of ways that might work around this problem, but it would probably be best to fix whatever is causing it. What char value is that box? [Can try System.out.println( (int)tf.getText().charAt(index) ).]
 
Tiago Sudeval
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian Cole,


Does it still happen if you (temporarily) do java.util.Locale.setDefault(java.util.Locale.US) first thing in main()?



What char value is that box? [Can try System.out.println(
(int)tf.getText().charAt(index) ).]


I did, but the result was:


if i enter comma of keyboard not numeric:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!