javax.swing.ComponentInputMap Java Examples
The following examples show how to use
javax.swing.ComponentInputMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CompareResultImages.java From diirt with MIT License | 6 votes |
/** * Creates new form CompareResultImages */ public CompareResultImages() { initComponents(); toReviewList.setModel(new DefaultListModel()); fillList(); setSize(800, 600); setExtendedState(getExtendedState() | MAXIMIZED_BOTH); actualImage.setStretch(false); referenceImage.setStretch(false); acceptAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control D")); InputMap keyMap = new ComponentInputMap(acceptButton); keyMap.put(KeyStroke.getKeyStroke("control D"), "accept"); ActionMap actionMap = new ActionMapUIResource(); actionMap.put("accept", acceptAction); SwingUtilities.replaceUIActionMap(acceptButton, actionMap); SwingUtilities.replaceUIInputMap(acceptButton, JComponent.WHEN_IN_FOCUSED_WINDOW, keyMap); }
Example #2
Source File: OutlineTable.java From netbeans with Apache License 2.0 | 5 votes |
private void filterInputMap(JComponent component, int condition) { InputMap imap = component.getInputMap(condition); if (imap instanceof ComponentInputMap) { imap = new F8FilterComponentInputMap(component, imap); } else { imap = new F8FilterInputMap(imap); } component.setInputMap(condition, imap); }
Example #3
Source File: EuropePanel.java From freecol with GNU General Public License v2.0 | 5 votes |
public EuropeButton(String text, int keyEvent, String command, ActionListener listener) { setOpaque(true); setText(text); setActionCommand(command); addActionListener(listener); InputMap closeInputMap = new ComponentInputMap(this); closeInputMap.put(KeyStroke.getKeyStroke(keyEvent, 0, false), "pressed"); closeInputMap.put(KeyStroke.getKeyStroke(keyEvent, 0, true), "released"); SwingUtilities.replaceUIInputMap(this, JComponent.WHEN_IN_FOCUSED_WINDOW, closeInputMap); }