This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
 
friki data migration
Ranch Hand
Posts: 772
  • Mark post as helpful
  • send pies
  • Report post to moderator
This code sample shows how to create a text field that only accepts digits as input. The idea comes from the API documentation of class JavaDoc:java.lang.JTextField, but this is a more complete example.

Note that the input is matched against a regular expression. If you need a text field for something different than numbers, you can easily change the regular expression to match the input that you want from the user.




CategoryCodeSamples CodeBarn
 
    Bookmark Topic Watch Topic
  • New Topic