Class ExtendedMouseFilter

  • Direct Known Subclasses:
    PopupMouseFilter

    public class ExtendedMouseFilter
    extends MouseFilter
    A class that accepts mouse events. Instances of this class are used by event-handling code to decide whether they are interested in a particular event. This class supports the extended event mechanism in jdk1.4, which allows proper distinction between ALT and Button2 and Meta and Button3.
    Version:
    $Id$
    Author:
    Steve Neuendorffer
    • Constructor Summary

      Constructors 
      Constructor Description
      ExtendedMouseFilter​(int button)
      Construct a mouse filter that responds to the given mouse buttons and modifier keys.
      ExtendedMouseFilter​(int button, int extendedModifiers)
      Construct a mouse filter that responds to the given mouse buttons and modifier keys.
      ExtendedMouseFilter​(int button, int extendedModifiers, int mask)
      Construct a mouse filter that responds to the given mouse buttons and modifier keys.
      ExtendedMouseFilter​(int button, int extendedModifiers, int mask, int pressNumber)
      Construct a mouse filter that responds to the given mouse buttons and modifier keys.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.awt.event.MouseEvent event)
      Test whether the given MouseEvent passes the filter.
      java.lang.String toString()
      Print a useful description of the mouse filter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • defaultFilter

        public static final MouseFilter defaultFilter
        The default mouse filter -- accepts button 1 with no modifiers.
      • selectionFilter

        public static final MouseFilter selectionFilter
        The default selection filter -- accepts button 1 with no modifiers.
      • alternateSelectionFilter

        public static final MouseFilter alternateSelectionFilter
        The alternate selection filter -- accepts button 1 with shift.
    • Constructor Detail

      • ExtendedMouseFilter

        public ExtendedMouseFilter​(int button)
        Construct a mouse filter that responds to the given mouse buttons and modifier keys. The arguments must be constructed using the button masks defined by java.awt.event.MouseEvent. More than one button can be specified, in which case the filter will accept events from any of them. In any case, modifier keys are ignored.
      • ExtendedMouseFilter

        public ExtendedMouseFilter​(int button,
                                   int extendedModifiers)
        Construct a mouse filter that responds to the given mouse buttons and modifier keys. The two arguments must be constructed using the button and modifier masks defined by java.awt.event.MouseEvent. More than one button can be specified, in which case the filter will accept events from any of them. The filter will accept modifier sets that exactly match modifiers.
      • ExtendedMouseFilter

        public ExtendedMouseFilter​(int button,
                                   int extendedModifiers,
                                   int mask)
        Construct a mouse filter that responds to the given mouse buttons and modifier keys. The three arguments must be constructed using the button and modifier masks defined by java.awt.event.MouseEvent. More than one button can be specified, in which case the filter will accept events triggered by any of them. The mask argument filters out modifiers that will be ignored; the filter will accept modifier sets that, after masking, exactly match modifiers.
      • ExtendedMouseFilter

        public ExtendedMouseFilter​(int button,
                                   int extendedModifiers,
                                   int mask,
                                   int pressNumber)
        Construct a mouse filter that responds to the given mouse buttons and modifier keys. The three arguments must be constructed using the button and modifier masks defined by java.awt.event.MouseEvent. More than one button can be specified, in which case the filter will accept events triggered by any of them. The mask argument filters out modifiers that will be ignored; the filter will accept modifier sets that, after masking, exactly match modifiers. The MouseFilter will only react to the press number given in the last argument. This will usually be one or two. Notice that if you want to react to drag events, they always have a press number of zero.
    • Method Detail

      • accept

        public boolean accept​(java.awt.event.MouseEvent event)
        Test whether the given MouseEvent passes the filter.
        Overrides:
        accept in class MouseFilter
      • toString

        public java.lang.String toString()
        Print a useful description of the mouse filter.
        Overrides:
        toString in class MouseFilter