If we want to limit the max characters to 2, then the below will suffice (note the length of 1 being used)
private void jTextField4KeyTyped(java.awt.event.KeyEvent evt)
{
boolean max = jTextField4.getText().length() > 1;
if ( max )
{
evt.consume();
}
}
[source]
No comments:
Post a Comment
Note: only a member of this blog may post a comment.