Ver Mensaje Individual
  #6 (permalink)  
Antiguo 15/06/2005, 08:54
cero2
 
Fecha de Ingreso: mayo-2005
Ubicación: España
Mensajes: 10
Antigüedad: 19 años
Puntos: 0
Si quieres limitar a 8 caracteres numericos tu jTextField, lo mas sencillo es usar un filtro como te han dicho, pero tienes que usarlo sobre un jFormattedTextField en vez de un jTextfield:

import javax.swing.text.*;
.......
try {
MaskFormatter mf1 = new MaskFormatter("########");
JFormattedTextField jft1 = new JFormattedTextField(mf1);
} catch (Exception e) { ... }

PD: cada # vale por un caracter numerico, y sin un try no funciona

Saludos :D