private void addKeyAction(final IKeyActionConfiguration configuration) { getLayeredPane() .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(configuration.getKeyStroke(), configuration.getActionKey()); getLayeredPane().getActionMap().put(configuration.getActionKey(), configuration.getAction()); }
/** * common constructor for all dialog view elements */ public AbstractDialog(Window owner) { super(owner); setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); setModalityType(ModalityType.APPLICATION_MODAL); setResizable(false); // close dialog on escape this.getLayeredPane().getActionMap().put("close", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { hideWindow(); } }); this.getLayeredPane() .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close"); }
.put(escKeyStroke, "esc-pressed"); getLayeredPane().getActionMap().put("esc-pressed", new AbstractAction() { public void actionPerformed(ActionEvent e) { searchField.setText("");
.put(escKeyStroke, "esc-pressed"); getLayeredPane().getActionMap().put("esc-pressed", new AbstractAction() { public void actionPerformed(ActionEvent e) { searchField.setText("");
.put(escKeyStroke, "esc-pressed"); getLayeredPane().getActionMap().put("esc-pressed", new AbstractAction() { public void actionPerformed(ActionEvent e) { if (tableModel.isFiltered()) {
.put(escKeyStroke, "esc-pressed"); getLayeredPane().getActionMap().put("esc-pressed", new AbstractAction() { public void actionPerformed(ActionEvent e) { if (tableModel.isFiltered()) {
getLayeredPane().getInputMap( JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ).put( KeyStroke.getKeyStroke( KeyEvent.VK_P, InputEvent.CTRL_MASK ), actionKey ); getLayeredPane().getActionMap().put( actionKey, new AbstractAction() { @Override public void actionPerformed( final ActionEvent event ) {
getLayeredPane().getActionMap().put( actionKey, new AbstractAction() { @Override public void actionPerformed( final ActionEvent event ) {