/** * create the dialog button controls. * * * @return panel containing button controls */ protected JComponent createButtonPanel() { // PENDING: this is a hack until we have a dedicated ButtonPanel! JPanel panel = new JPanel(new BasicOptionPaneUI.ButtonAreaLayout(true, 6)) { @Override public Dimension getMaximumSize() { return getPreferredSize(); } }; panel.setBorder(BorderFactory.createEmptyBorder(9, 0, 0, 0)); Action executeAction = getAction(EXECUTE_ACTION_COMMAND); Action closeAction = getAction(CLOSE_ACTION_COMMAND); JButton defaultButton = new JButton(executeAction); panel.add(defaultButton); getRootPane().setDefaultButton(defaultButton); if (executeAction != closeAction) { JButton b = new JButton(closeAction); panel.add(b); getRootPane().setCancelButton(b); } return panel; }
/** * create the dialog button controls. * * * @return panel containing button controls */ protected JComponent createButtonPanel() { // PENDING: this is a hack until we have a dedicated ButtonPanel! JPanel panel = new JPanel(new BasicOptionPaneUI.ButtonAreaLayout(true, 6)) { @Override public Dimension getMaximumSize() { return getPreferredSize(); } }; panel.setBorder(BorderFactory.createEmptyBorder(9, 0, 0, 0)); Action executeAction = getAction(EXECUTE_ACTION_COMMAND); Action closeAction = getAction(CLOSE_ACTION_COMMAND); JButton findButton = new JButton(executeAction); panel.add(findButton); if (executeAction != closeAction) { panel.add(new JButton(closeAction)); } KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false); KeyStroke escapeKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false); InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.put(enterKey, EXECUTE_ACTION_COMMAND); inputMap.put(escapeKey, CLOSE_ACTION_COMMAND); getRootPane().setDefaultButton(findButton); return panel; }
public @Override void restored() { // javax.swing.plaf.OptionPaneUI mentioned in method signature: new JOptionPane().setUI(new BasicOptionPaneUI()); System.setProperty("my.bundle.worked", "true"); }