Java Code Examples for javax.swing.JComponent.WHEN_FOCUSED

The following are Jave code examples for showing how to use WHEN_FOCUSED of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Tarski   File: EditorKeyboardHandler.java   View Source Code Vote up 6 votes
/**
 * Return JTree's input map.
 */
protected InputMap getInputMap(int condition)
{
	InputMap map = super.getInputMap(condition);

	if (condition == JComponent.WHEN_FOCUSED && map != null)
	{
		map.put(KeyStroke.getKeyStroke("control S"), "save");
		map.put(KeyStroke.getKeyStroke("control shift S"), "saveAs");
		map.put(KeyStroke.getKeyStroke("control N"), "new");
		map.put(KeyStroke.getKeyStroke("control O"), "open");

		map.put(KeyStroke.getKeyStroke("control Z"), "undo");
		map.put(KeyStroke.getKeyStroke("control Y"), "redo");
		map
				.put(KeyStroke.getKeyStroke("control shift V"),
						"selectVertices");
		map.put(KeyStroke.getKeyStroke("control shift E"), "selectEdges");
	}

	return map;
}
 
Example 2
Project: Tarski   File: KeyboardHandler.java   View Source Code Vote up 6 votes
/**
 * Return JTree's input map.
 */
@Override
protected InputMap getInputMap(final int condition) {
  final InputMap map = super.getInputMap(condition);

  if (condition == JComponent.WHEN_FOCUSED && map != null) {
    // map.put(KeyStroke.getKeyStroke("control S"), "save");
    // map.put(KeyStroke.getKeyStroke("control shift S"), "saveAs");
    // map.put(KeyStroke.getKeyStroke("control N"), "new");
    // map.put(KeyStroke.getKeyStroke("control O"), "open");
    //
    // map.put(KeyStroke.getKeyStroke("control Z"), "undo");
    // map.put(KeyStroke.getKeyStroke("control Y"), "redo");
    // map.put(KeyStroke.getKeyStroke("control shift V"), "selectVertices");
    // map.put(KeyStroke.getKeyStroke("control shift E"), "selectEdges");
  }

  return map;
}
 
Example 3
Project: Tarski   File: EditorKeyboardHandler.java   View Source Code Vote up 6 votes
/**
 * Return JTree's input map.
 */
protected InputMap getInputMap(int condition) {
  InputMap map = super.getInputMap(condition);

  if (condition == JComponent.WHEN_FOCUSED && map != null) {
    map.put(KeyStroke.getKeyStroke("control S"), "save");
    map.put(KeyStroke.getKeyStroke("control shift S"), "saveAs");
    map.put(KeyStroke.getKeyStroke("control N"), "new");
    map.put(KeyStroke.getKeyStroke("control O"), "open");

    map.put(KeyStroke.getKeyStroke("control Z"), "undo");
    map.put(KeyStroke.getKeyStroke("control Y"), "redo");
    map.put(KeyStroke.getKeyStroke("control shift V"), "selectVertices");
    map.put(KeyStroke.getKeyStroke("control shift E"), "selectEdges");
  }

  return map;
}