Fixed Length TextFields
Posted on 1998-06-10
I am using swing's JTextField and I need to limit the characters a user can type into it. I am using a KEY_EVENT_MASK to capture the keystroke and consume it if necessary. However, how can I capture a user pasting into the TextField and how can I consume the extra text the User may have pasted into it (i.e. If the textfield can only have 6 characters and the user attempts to paste 10 characters)?