File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Decimal Format is not setting the value in text field correctly.

 
Chinmay Kant
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a text field which will have only Integer (positive and negative values). So,I am using JFormattedtextField as shown below:-

The getFormatter(0 method is as follows:-

This makes me only type 0 to 9 and - sign iniside the text box.
My Problem:-
I have already a neagtive value like "-1222" inside the text field
[Now using if a set a value which is positive i.e "1234"
then after that i see the result as "-1234"
Here though my value was positive, it did not remove the negative sign
What could be the problem not getting???
Is my formatter wrong??


 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use a JSpinner with a SpinnerNumberModel?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic