Ver Mensaje Individual
  #2 (permalink)  
Antiguo 05/09/2012, 16:13
Avatar de jefraroce
jefraroce
 
Fecha de Ingreso: mayo-2012
Mensajes: 4
Antigüedad: 12 años
Puntos: 0
Respuesta: cómo creo una máscara en jTextfield?

con un JFormattedTextField(), este permite configurar el tipo de datos que, se quiere que ingrese y la forma de hacerlo. Valida lo ingreso y lo comoda a este. Es muy util xD. Para lo que necesitas tendrias que tener algo así:

//CREA UNA INSTANCIA DEL JFormattedTextField
javax.swing.JFormattedTextField fecha = new javax.swing.JFormattedTextField();

//SE CONFIGURA EL FORMATO DE LOS DATOS DE ENTRADA EN EL MISMO
fecha.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("dd/MM/yyyy"))));

Saludos, y suerte con lo tuyo. :D