Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

set jtextfield max length

textField = new JTextField();
    textField.addKeyListener(new KeyAdapter() {
        @Override
        public void keyTyped(KeyEvent e) {
            if (txtGuess.getText().length() >= 3 ) // limit to 3 characters
                e.consume();
        }
    });
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #jtextfield #max #length
ADD COMMENT
Topic
Name
3+9 =