Search in sources :

Example 71 with JRootPane

use of javax.swing.JRootPane in project Course_Generator by patrovite.

the class FrmColorChooser method createRootPane.

/**
 * Manage low level key strokes
 * ESCAPE : Close the window
 * @return
 */
protected JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    KeyStroke strokeEscape = KeyStroke.getKeyStroke("ESCAPE");
    KeyStroke strokeEnter = KeyStroke.getKeyStroke("ENTER");
    Action actionListener = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    };
    Action actionListenerEnter = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            RequestToClose();
        }
    };
    InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(strokeEscape, "ESCAPE");
    rootPane.getActionMap().put("ESCAPE", actionListener);
    inputMap.put(strokeEnter, "ENTER");
    rootPane.getActionMap().put("ENTER", actionListenerEnter);
    return rootPane;
}
Also used : Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) InputMap(javax.swing.InputMap) AbstractAction(javax.swing.AbstractAction)

Example 72 with JRootPane

use of javax.swing.JRootPane in project Course_Generator by patrovite.

the class FrmImportChoice method createRootPane.

/**
 * Manage low level key strokes ESCAPE : Close the window
 *
 * @return
 */
protected JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    KeyStroke strokeEscape = KeyStroke.getKeyStroke("ESCAPE");
    KeyStroke strokeEnter = KeyStroke.getKeyStroke("ENTER");
    Action actionListener = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    };
    Action actionListenerEnter = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            RequestToClose();
        }
    };
    InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(strokeEscape, "ESCAPE");
    rootPane.getActionMap().put("ESCAPE", actionListener);
    inputMap.put(strokeEnter, "ENTER");
    rootPane.getActionMap().put("ENTER", actionListenerEnter);
    return rootPane;
}
Also used : Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) InputMap(javax.swing.InputMap) AbstractAction(javax.swing.AbstractAction)

Example 73 with JRootPane

use of javax.swing.JRootPane in project Course_Generator by patrovite.

the class FrmSelectMap method createRootPane.

/**
 * Manage low level key strokes ESCAPE : Close the window
 *
 * @return
 */
protected JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    KeyStroke strokeEscape = KeyStroke.getKeyStroke("ESCAPE");
    KeyStroke strokeEnter = KeyStroke.getKeyStroke("ENTER");
    Action actionListener = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    };
    Action actionListenerEnter = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            RequestToClose();
        }
    };
    InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(strokeEscape, "ESCAPE");
    rootPane.getActionMap().put("ESCAPE", actionListener);
    inputMap.put(strokeEnter, "ENTER");
    rootPane.getActionMap().put("ENTER", actionListenerEnter);
    return rootPane;
}
Also used : Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) InputMap(javax.swing.InputMap) AbstractAction(javax.swing.AbstractAction)

Example 74 with JRootPane

use of javax.swing.JRootPane in project Course_Generator by patrovite.

the class frmEditPoint method createRootPane.

/**
 * Manage low level key strokes ESCAPE : Close the window
 *
 * @return
 */
protected JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    KeyStroke strokeEscape = KeyStroke.getKeyStroke("ESCAPE");
    KeyStroke strokeEnter = KeyStroke.getKeyStroke("ENTER");
    Action actionListener = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    };
    Action actionListenerEnter = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            RequestToClose();
        }
    };
    InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(strokeEscape, "ESCAPE");
    rootPane.getActionMap().put("ESCAPE", actionListener);
    inputMap.put(strokeEnter, "ENTER");
    rootPane.getActionMap().put("ENTER", actionListenerEnter);
    return rootPane;
}
Also used : Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) InputMap(javax.swing.InputMap) AbstractAction(javax.swing.AbstractAction)

Example 75 with JRootPane

use of javax.swing.JRootPane in project Course_Generator by patrovite.

the class FrmConfigMrb method createRootPane.

/**
 * Manage low level key strokes ESCAPE : Close the window
 *
 * @return
 */
protected JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    KeyStroke strokeEscape = KeyStroke.getKeyStroke("ESCAPE");
    KeyStroke strokeEnter = KeyStroke.getKeyStroke("ENTER");
    Action actionListener = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    };
    Action actionListenerEnter = new AbstractAction() {

        public void actionPerformed(ActionEvent actionEvent) {
            RequestToClose();
        }
    };
    InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(strokeEscape, "ESCAPE");
    rootPane.getActionMap().put("ESCAPE", actionListener);
    inputMap.put(strokeEnter, "ENTER");
    rootPane.getActionMap().put("ENTER", actionListenerEnter);
    return rootPane;
}
Also used : Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) InputMap(javax.swing.InputMap) AbstractAction(javax.swing.AbstractAction)

Aggregations

JRootPane (javax.swing.JRootPane)89 ActionEvent (java.awt.event.ActionEvent)48 KeyStroke (javax.swing.KeyStroke)34 AbstractAction (javax.swing.AbstractAction)32 Action (javax.swing.Action)29 InputMap (javax.swing.InputMap)26 JPanel (javax.swing.JPanel)16 BorderLayout (java.awt.BorderLayout)14 JButton (javax.swing.JButton)13 ActionListener (java.awt.event.ActionListener)12 JLabel (javax.swing.JLabel)12 FlowLayout (java.awt.FlowLayout)10 Container (java.awt.Container)9 Dimension (java.awt.Dimension)9 Insets (java.awt.Insets)9 BoxLayout (javax.swing.BoxLayout)9 Component (java.awt.Component)8 Frame (java.awt.Frame)7 JScrollPane (javax.swing.JScrollPane)7 GridBagConstraints (java.awt.GridBagConstraints)6