List of usage examples for javax.swing JComponent WHEN_FOCUSED
int WHEN_FOCUSED
To view the source code for javax.swing JComponent WHEN_FOCUSED.
Click Source Link
registerKeyboardAction
that means that the command should be invoked when the component has the focus. From source file:Main.java
public static void main(String[] argv) { JTextField component = new JTextField(10); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed X"), "none"); JFrame f = new JFrame(); f.add(component);//w ww.j a va 2s .c om f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) { JTextField component = new JTextField(10); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(new Character(' '), 0), "none"); JFrame f = new JFrame(); f.add(component);//www . ja v a2 s . c om f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) { JTextField component = new JTextField(10); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed -"), "actionName"); JFrame f = new JFrame(); f.add(component);//from www . ja va 2 s. c o m f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) { JTextField component = new JTextField(10); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed a"), "actionName"); JFrame f = new JFrame(); f.add(component);/*from w w w.j a v a2s . com*/ f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) { JTextField component = new JTextField(10); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed X"), "none"); JFrame f = new JFrame(); f.add(component);// w w w. j a v a2 s. c o m f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) { JTextField component = new JTextField(10); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed $"), "actionName"); JFrame f = new JFrame(); f.add(component);/*www.j a va2 s.co m*/ f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) { JTextField component = new JTextField(10); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(new Character(' '), 0), "actionName"); JFrame f = new JFrame(); f.add(component);/* w ww.j a v a 2 s .c o m*/ f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) { JTextField component = new JTextField(10); component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("shift pressed SPACE"), "actionName"); JFrame f = new JFrame(); f.add(component);//from ww w.ja v a2 s . com f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { InputMap inputMap = new InputMap(); inputMap.put(KeyStroke.getKeyStroke("F2"), "actionName"); JButton component = new JButton("button"); inputMap.setParent(component.getInputMap(JComponent.WHEN_FOCUSED)); component.setInputMap(JComponent.WHEN_FOCUSED, inputMap); }
From source file:Main.java
public static void main(String[] argv) throws Exception { InputMap inputMap = new InputMap(); inputMap.put(KeyStroke.getKeyStroke("F2"), "actionName"); JButton component = new JButton("button"); inputMap.setParent(component.getInputMap(JComponent.WHEN_FOCUSED)); component.setInputMap(JComponent.WHEN_FOCUSED, inputMap); inputMap.clear();//from ww w . ja va 2 s .co m }