Package javax.swing

Examples of javax.swing.ActionMap


        }
        return im;
    }

    private ActionMap getActionMap(final int generation) {
        ActionMap am = jta.getActionMap();
        for (int i = 0; i < generation; i++) {
            am = am.getParent();
        }
        return am;
    }
View Full Code Here


    }

    public void testFocusAccelerator() throws Exception {
        jta.setFocusAccelerator('a');
        InputMap im = SwingUtilities.getUIInputMap(jta, JComponent.WHEN_IN_FOCUSED_WINDOW);
        ActionMap am = jta.getActionMap().getParent().getParent();
        assertNotNull(am);
        assertNotNull(im);
        assertEquals(1, im.size());
        assertTrue(am.size() > 0);
        assertEquals(im.keys()[0], KeyStroke.getKeyStroke('A', InputEvent.ALT_DOWN_MASK));
        Object actionName = im.get(im.keys()[0]);
        assertNotNull(am.get(actionName));
    }
View Full Code Here

        }
        return im;
    }

    private ActionMap getActionMap(final int generation) {
        ActionMap am = jta.getActionMap();
        for (int i = 0; i < generation; i++) {
            am = am.getParent();
        }
        return am;
    }
View Full Code Here

    }

    public void testFocusAccelerator() throws Exception {
        jta.setFocusAccelerator('a');
        InputMap im = SwingUtilities.getUIInputMap(jta, JComponent.WHEN_IN_FOCUSED_WINDOW);
        ActionMap am = jta.getActionMap().getParent().getParent();
        assertNotNull(am);
        assertNotNull(im);
        assertEquals(1, im.size());
        assertTrue(am.size() > 0);
        assertEquals(im.keys()[0], KeyStroke.getKeyStroke('A', InputEvent.ALT_DOWN_MASK));
        Object actionName = im.get(im.keys()[0]);
        assertNotNull(am.get(actionName));
    }
View Full Code Here

    pack();
    LibSwingUtil.centerDialogInParent(this);


    final InputMap inputMap = contentPane.getInputMap();
    final ActionMap actionMap = contentPane.getActionMap();

    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NON-NLS
    actionMap.put("cancel", new CloseAction()); // NON-NLS

  }
View Full Code Here

    }

    tree.getSelectionModel().addTreeSelectionListener(new TreeLeadSelectionListener());
    tree.addMouseListener(new ReportTreeContextMenuHandler());

    final ActionMap map = tree.getActionMap();
    map.put(TransferHandler.getCutAction().getValue(Action.NAME), cutAction);
    map.put(TransferHandler.getCopyAction().getValue(Action.NAME), copyAction);
    map.put(TransferHandler.getPasteAction().getValue(Action.NAME), pasteAction);

    setLayout(new BorderLayout());
    add(new JScrollPane(tree), BorderLayout.CENTER);
  }
View Full Code Here

    LibSwingUtil.centerFrameOnScreen(this);


    final InputMap inputMap = contentPane.getInputMap();
    final ActionMap actionMap = contentPane.getActionMap();

    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NON-NLS
    actionMap.put("cancel", new CloseAction()); // NON-NLS
  }
View Full Code Here

    buttonsPanel.add(closeButton);
    mainPanel.add(buttonsPanel, BorderLayout.SOUTH);

    final JComponent contentPane = (JComponent) getContentPane();
    final InputMap inputMap = contentPane.getInputMap();
    final ActionMap actionMap = contentPane.getActionMap();

    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NON-NLS
    actionMap.put("cancel", new CloseAction()); // NON-NLS

    setResizable(true);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setSize(800, 600);
  }
View Full Code Here

    contentPane.add(createContentPane(), BorderLayout.CENTER);
    contentPane.add(buttonPanel, BorderLayout.SOUTH);
    setContentPane(contentPane);

    final InputMap inputMap = contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    final ActionMap actionMap = contentPane.getActionMap();

    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "confirm"); // NON-NLS
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NON-NLS
    actionMap.put("confirm", getConfirmAction()); // NON-NLS
    actionMap.put("cancel", getCancelAction()); // NON-NLS

    resizeDialog();
  }
View Full Code Here

    buttonsPanel.setLayout(new GridLayout(2, 1));
    buttonsPanel.add(okButton);
    buttonsPanel.add(cancelButton);
    buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25, 0, 10, 10));

    ActionMap actionMap = buttonsPanel.getActionMap();
    actionMap.put(cancelAction.getValue(Action.DEFAULT), cancelAction);
    actionMap.put(okAction.getValue(Action.DEFAULT), okAction);
    InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), cancelAction.getValue(Action.DEFAULT));
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), okAction.getValue(Action.DEFAULT));

    JPanel dialogEastPanel = new JPanel();
View Full Code Here

TOP

Related Classes of javax.swing.ActionMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.