Win a copy of Design for the Mind this week in the Design 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