I\'m trying to make a textfield that limits a user input. I have this code:
private void jTextField5KeyTyped(java.awt.event.KeyEvent evt) {
Here's a simple way to do it:
private void textFieldKeyTyped(java.awt.event.KeyEvent evt) { if(textField.getText().length()>=2) { evt.consume(); } }