Class InputMapUtils


  • public final class InputMapUtils
    extends java.lang.Object
    Tools to work with Swing InputMap.
    Since:
    5200
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private InputMapUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addCtrlEnterAction​(javax.swing.JComponent c, javax.swing.Action a)
      Add an action activated with Ctrl+Enter key on a component.
      static void addEnterAction​(javax.swing.JComponent c, javax.swing.Action a)
      Add an action activated with Enter key on a component.
      private static void addEnterAction​(javax.swing.JComponent c, javax.swing.Action a, int condition)  
      static void addEnterActionWhenAncestor​(javax.swing.JComponent c, javax.swing.Action a)
      Add an action activated with Enter key on a component or its children.
      static void addEscapeAction​(javax.swing.JComponent c, javax.swing.Action a)
      Add an action activated with ESCAPE key on a component or its children.
      static void addSpacebarAction​(javax.swing.JComponent c, javax.swing.Action a)
      Add an action activated with Spacebar key on a component.
      static void enableEnter​(javax.swing.JButton b)
      Enable activating button on Enter (which is replaced with spacebar for certain Look-And-Feels).
      static void unassignCtrlShiftUpDown​(javax.swing.JComponent cmp, int condition)
      Unassign Ctrl-Shift/Alt-Shift Up/Down from the given component to allow global JOSM shortcuts to work in this component.
      static void unassignPageUpDown​(javax.swing.JComponent cmp, int condition)
      Unassign PageUp/PageDown from the given component to allow global JOSM shortcuts to work in this component.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • unassignCtrlShiftUpDown

        public static void unassignCtrlShiftUpDown​(javax.swing.JComponent cmp,
                                                   int condition)
        Unassign Ctrl-Shift/Alt-Shift Up/Down from the given component to allow global JOSM shortcuts to work in this component.
        Parameters:
        cmp - The Swing component
        condition - one of the following values:
        • JComponent.FOCUS_INPUTMAP_CREATED
        • JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
        • JComponent.WHEN_IN_FOCUSED_WINDOW
      • unassignPageUpDown

        public static void unassignPageUpDown​(javax.swing.JComponent cmp,
                                              int condition)
        Unassign PageUp/PageDown from the given component to allow global JOSM shortcuts to work in this component.
        Parameters:
        cmp - The Swing component
        condition - one of the following values:
        • JComponent.FOCUS_INPUTMAP_CREATED
        • JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
        • JComponent.WHEN_IN_FOCUSED_WINDOW
        Since:
        6557
      • enableEnter

        public static void enableEnter​(javax.swing.JButton b)
        Enable activating button on Enter (which is replaced with spacebar for certain Look-And-Feels).
        Parameters:
        b - Button
      • addEnterAction

        public static void addEnterAction​(javax.swing.JComponent c,
                                          javax.swing.Action a)
        Add an action activated with Enter key on a component.
        Parameters:
        c - The Swing component
        a - action activated with Enter key
        See Also:
        JComponent.WHEN_FOCUSED
      • addEnterActionWhenAncestor

        public static void addEnterActionWhenAncestor​(javax.swing.JComponent c,
                                                      javax.swing.Action a)
        Add an action activated with Enter key on a component or its children.
        Parameters:
        c - The Swing component
        a - action activated with Enter key
        Since:
        10790
        See Also:
        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
      • addEnterAction

        private static void addEnterAction​(javax.swing.JComponent c,
                                           javax.swing.Action a,
                                           int condition)
      • addSpacebarAction

        public static void addSpacebarAction​(javax.swing.JComponent c,
                                             javax.swing.Action a)
        Add an action activated with Spacebar key on a component.
        Parameters:
        c - The Swing component
        a - action activated with Spacebar key
      • addEscapeAction

        public static void addEscapeAction​(javax.swing.JComponent c,
                                           javax.swing.Action a)
        Add an action activated with ESCAPE key on a component or its children.
        Parameters:
        c - The Swing component
        a - action activated with ESCAPE key
        Since:
        10791
        See Also:
        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
      • addCtrlEnterAction

        public static void addCtrlEnterAction​(javax.swing.JComponent c,
                                              javax.swing.Action a)
        Add an action activated with Ctrl+Enter key on a component.
        Parameters:
        c - The Swing component
        a - action activated with Ctrl+Enter key
        See Also:
        JComponent.WHEN_IN_FOCUSED_WINDOW