Class ModifierTracker



  • public class ModifierTracker
    extends Object
    This keeps track of which modifiers are currently pressed.

    For example, if you need the cursor to change when the alt key is pressed: just add a listener to this class and you will be notified when appropriate.

    • Constructor Detail

      • ModifierTracker

        public ModifierTracker()
    • Method Detail

      • track

        public static void track(JApplet applet)
        Add KeyListeners to everything in an applet.

        Unsigned applets can't simply add an event listener to the toolkit for security reasons, so this method provides an alternative approach.

        This alternative should work in controlled environments where components are not added to an applet after this method is called, but in other cases it might fail.

        Parameters:
        applet - the applet to track
      • isActive

        public static boolean isActive()
      • getModifiers

        public static int getModifiers()
      • addAltChangeListener

        public static void addAltChangeListener(ChangeListener l)
      • addAltGraphChangeListener

        public static void addAltGraphChangeListener(ChangeListener l)
      • addMetaChangeListener

        public static void addMetaChangeListener(ChangeListener l)
      • addShiftChangeListener

        public static void addShiftChangeListener(ChangeListener l)
      • addControlChangeListener

        public static void addControlChangeListener(ChangeListener l)
      • isAltDown

        public static boolean isAltDown()
      • isAltGraphyDown

        public static boolean isAltGraphyDown()
      • isShiftDown

        public static boolean isShiftDown()
      • isMetaDown

        public static boolean isMetaDown()
      • isControlDown

        public static boolean isControlDown()
      • removeAltChangeListener

        public static void removeAltChangeListener(ChangeListener l)
      • removeAltGraphChangeListener

        public static void removeAltGraphChangeListener(ChangeListener l)
      • removeMetaChangeListener

        public static void removeMetaChangeListener(ChangeListener l)
      • removeShiftChangeListener

        public static void removeShiftChangeListener(ChangeListener l)
      • removeControlChangeListener

        public static void removeControlChangeListener(ChangeListener l)