Java InputMap.size()
Syntax
InputMap.size() has the following syntax.
public int size()
Example
In the following code shows how to use InputMap.size() method.
import javax.swing.InputMap;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.KeyStroke;
// ww w . ja va 2 s . c o m
public class Main {
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);
System.out.println(inputMap.size());
}
}
Home »
Java Tutorial »
javax.swing »
Java Tutorial »
javax.swing »