[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keypad



I haven't done it in Java but many times in HTML I'll run a script each time a key is pressed that measures the length of the string in the textarea and if greater than a specified length I'll do a mid function to crop the string back to the length I want and put my string back in the field.  I would imagine you could do the same thing with a JTextfield if someone doesn't tell you an easier way.
 
Just a thought!
 
Scott
----- Original Message -----
Sent: Tuesday, December 18, 2001 5:18 PM
Subject: keypad

I have created a keypad using a JTextfield, 12 JButtons, and a JDialog window. Is there a way to set a Listener on the JTextField that won't allow any more than four characters to be typed in it?

Thanks,

-Jason