This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JText Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JText" Watch "JText" New topic


Vaskar Dasgupta

Joined: Jul 20, 2001
Posts: 25
I would like to restrict the user to enter a minimum of 3 characters and a maximum of 8 characters in the 'UserID' text field (JTextField), is there any API for this in java. Can you suggest any solution ?
Thanks in advance.

Kindly reply back.
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Here is a link to the Sun tutorial Go to the creating validated textfields section. In the example check out the insertString method. You will need to modify that to limit the entry.
subject: JText
It's not a secret anymore!