Java Swing KeyStroke create
import javax.swing.KeyStroke; public class Main { public static void main(String[] a) { System.out.println(KeyStroke.getKeyStroke("F2")); System.out.println(KeyStroke.getKeyStroke("control A")); System.out.println(KeyStroke.getKeyStroke("shift F2")); System.out.println(KeyStroke.getKeyStroke('(')); System.out.println(KeyStroke.getKeyStroke("button3 F")); System.out.println(KeyStroke.getKeyStroke("typed x")); System.out.println(KeyStroke.getKeyStroke("released DELETE")); System.out.println(KeyStroke.getKeyStroke("shift UP")); }//from w w w. j a v a 2 s .co m }