hope this help... it limits the character being inputted, just changed the value 10
public void keyTyped(KeyEvent e){
if (getText().length() >= 10) e.consume();
}
public void keyPressed(KeyEvent e) {
// do nothing
}
public void keyReleased(KeyEvent e) {
// do nothing
}