Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/09/2011, 19:46
fbvictorcifuentes
 
Fecha de Ingreso: septiembre-2011
Ubicación: Roldanillo
Mensajes: 1
Antigüedad: 12 años, 7 meses
Puntos: 1
Respuesta: Cambiar minusculas a mayusculas en un TextField

Hola,

Te recomendaría usar la función setDocument() de JTextField.
Ejemplo:
Código:
class JTextFieldToUpperCase extends PlainDocument {
 
  public void insertString(int offset, String str, AttributeSet attr) throws BadLocationException {
      super.insertString(offset, str.toUpperCase(), attr);
    }
  }
}


public class TuClase {
---
public TuClase(){
      ...
      txtUsuario.setDocument(new JTextFieldToUpperCase());
      ...
}
---
}