An example of this is the validation that a textfield, its length is equal to 4 but, how would you do so that when entering you are only numbers and only letters?
public void keyTyped(KeyEvent e)
{
if(e.getSource().equals(t.getTxtdesc()))
{
String Cade=t.getTxtdesc().getText();
if(Cade.length()==45)
{
JOptionPane.showMessageDialog(null, "Ha superado el limite", "AVISO", JOptionPane.WARNING_MESSAGE);
e.consume();
}
}