Here you can find the source of ponerMayuscula(KeyEvent e, JTextField textField)
public static void ponerMayuscula(KeyEvent e, JTextField textField)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.awt.event.KeyEvent; public class Main { public static void ponerMayuscula(KeyEvent e, JTextField textField) { char keyChar = e.getKeyChar(); if (Character.isLetter(keyChar)) textField.setText(textField.getText().trim().toUpperCase()); }//from w w w. j a v a2 s . co m }