Class MnemonicHandler

  • All Implemented Interfaces:
    java.awt.KeyEventPostProcessor, java.util.EventListener, javax.swing.event.ChangeListener

    class MnemonicHandler
    extends java.lang.Object
    implements java.awt.KeyEventPostProcessor, javax.swing.event.ChangeListener
    Show/hide mnemonics.
    • Field Detail

      • showMnemonics

        private static boolean showMnemonics
      • lastShowMnemonicWindow

        private static java.lang.ref.WeakReference<java.awt.Window> lastShowMnemonicWindow
      • windowListener

        private static java.awt.event.WindowListener windowListener
      • altPressedEventCount

        private static int altPressedEventCount
      • selectMenuOnAltReleased

        private static boolean selectMenuOnAltReleased
    • Constructor Detail

      • MnemonicHandler

        MnemonicHandler()
    • Method Detail

      • isShowMnemonics

        static boolean isShowMnemonics()
      • install

        void install()
      • uninstall

        void uninstall()
      • postProcessKeyEvent

        public boolean postProcessKeyEvent​(java.awt.event.KeyEvent e)
        Specified by:
        postProcessKeyEvent in interface java.awt.KeyEventPostProcessor
      • shouldShowMnemonics

        private boolean shouldShowMnemonics​(java.awt.event.KeyEvent e)
      • processKeyEventOnWindows

        private boolean processKeyEventOnWindows​(java.awt.event.KeyEvent e)
        Special Alt key behavior on Windows. Press-and-release Alt key selects first menu (if available) and moves focus temporary to menu bar. If menu bar has focus (some menu is selected), pressing Alt key unselects menu and moves focus back to permanent focus owner.
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent e)
        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
      • showMnemonics

        static void showMnemonics​(boolean show,
                                  java.awt.Component c)
      • repaintMnemonics

        private static void repaintMnemonics​(java.awt.Container container)
      • hasMnemonic

        private static boolean hasMnemonic​(java.awt.Component c)