is it possible to limit the lenght of a JtextField?


Yup add a document to the jtextfield .. hmm like

class JTextFieldLimit extends PlainDocument {
	   private int limit; 
	   JTextFieldLimit(int limit) {
	    this.limit = limit;
	   public void insertString
	     (int offset, String  str, AttributeSet attr)
	       throws BadLocationException {
	    if (str == null) return;

	    if ((getLength() + str.length()) <= limit) {
	      super.insertString(offset, str, attr);

instanciate your JTextField and set the document to be one of these ^

JTextField mine = new JTextField();
mine.setDocument(new JTextFieldLimit(10));


JTextField mine = new JTextField(new JTextFieldLimit(10), "blah", 15);

can do something similar to make 'number only' fields or automatically convert everything to upper case etc etc etc