Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to make JTextField accepts negative numeric input?  RSS feed

 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I want to make a JTextField accept only postive or negative numeric input.

I am using the below line which accepts only positive numbers now.

JTextField field1 = new JTextField(new JTextFieldModel(17, false, false, true), "", 1000)

Please suggest me how can I make this to accepts negative numbers also??

Thanks in Advance...
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at NumericTextField
 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks !! This helped me.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!