## visad
Class DisplayEvent

    java.lang.Object
      java.awt.Event
          visad.VisADEvent
              visad.DisplayEvent

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  DisplayMapEvent, DisplayReferenceEvent

public class DisplayEvent
extends VisADEvent

DisplayEvent is the VisAD class for Events from Display objects. They are sourced by Display objects and received by DisplayListener objects.

See Also:
  Serialized Form

Field Summary
`static int` `COMPONENT_RESIZED` The "component resized" event.
`static int` `DESTROYED` The "display destroyed" event.
`static int` `FRAME_DONE` The "frame done" event.
`static int` `KEY_PRESSED` The "key pressed" event.
`static int` `KEY_RELEASED` The "key released" event.
`static int` `MAP_ADDED` The "map added" event.
`static int` `MAP_REMOVED` The "map removed" event.
`static int` `MAPS_CLEARED` The "maps cleared" event.
`static int` `MOUSE_DRAGGED` The "mouse dragged" event.
`static int` `MOUSE_ENTERED` The "mouse entered" event.
`static int` `MOUSE_EXITED` The "mouse exited" event.
`static int` `MOUSE_MOVED` The "mouse moved" event.
`static int` `MOUSE_PRESSED` The "mouse pressed" event.
`static int` `MOUSE_PRESSED_CENTER` The "center mouse button pressed" event.
`static int` `MOUSE_PRESSED_LEFT` The "left mouse button pressed" event.
`static int` `MOUSE_PRESSED_RIGHT` The "right mouse button pressed" event.
`static int` `MOUSE_RELEASED` The "mouse released" event.
`static int` `MOUSE_RELEASED_CENTER` The "center mouse button released" event.
`static int` `MOUSE_RELEASED_LEFT` The "left mouse button released" event.
`static int` `MOUSE_RELEASED_RIGHT` The "right mouse button released" event.
`static int` `REFERENCE_ADDED` The "reference added" event.
`static int` `REFERENCE_REMOVED` The "reference removed" event.
`static int` `TRANSFORM_DONE` The "transform done" event.
`static int` `WAIT_OFF` The "display wait off" event.
`static int` `WAIT_ON` The "display wait on" event.

Fields inherited from class visad.VisADEvent
`LOCAL_SOURCE, UNKNOWN_REMOTE_SOURCE`

Fields inherited from class java.awt.Event

`ACTION_EVENT, ALT_MASK, arg, BACK_SPACE, CAPS_LOCK, clickCount, CTRL_MASK, DELETE, DOWN, END, ENTER, ESCAPE, evt, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, GOT_FOCUS, HOME, INSERT, key, KEY_ACTION, KEY_ACTION_RELEASE, KEY_PRESS, KEY_RELEASE, LEFT, LIST_DESELECT, LIST_SELECT, LOAD_FILE, LOST_FOCUS, META_MASK, modifiers, MOUSE_DOWN, MOUSE_DRAG, MOUSE_ENTER, MOUSE_EXIT, MOUSE_MOVE, MOUSE_UP, NUM_LOCK, PAUSE, PGDN, PGUP, PRINT_SCREEN, RIGHT, SAVE_FILE, SCROLL_ABSOLUTE, SCROLL_BEGIN, SCROLL_END, SCROLL_LINE_DOWN, SCROLL_LINE_UP, SCROLL_LOCK, SCROLL_PAGE_DOWN, SCROLL_PAGE_UP, SHIFT_MASK, TAB, target, UP, when, WINDOW_DEICONIFY, WINDOW_DESTROY, WINDOW_EXPOSE, WINDOW_ICONIFY, WINDOW_MOVED, x, y`

Constructor Summary
`DisplayEvent(Display d, int id_d)` Constructs a DisplayEvent object with the specified source display, and type of event.
`DisplayEvent(Display d, int id_d, InputEvent e)` Constructs a DisplayEvent object with the specified source display, type of event, and mouse event describing mouse details.
`DisplayEvent(Display d, int id_d, InputEvent e, int remoteId)` Constructs a DisplayEvent object with the specified source display, type of event, mouse event describing mouse details, and remote flag indicating whether event came from a remote source.
`DisplayEvent(Display d, int id_d, int remoteId)` Constructs a DisplayEvent object with the specified source display, and type of event.
`DisplayEvent(Display d, int id_d, int x, int y)` Constructs a DisplayEvent object with the specified source display, type of event, and mouse positions where event occurred.
`DisplayEvent(Display d, int id_d, int x, int y, int remoteId)` Constructs a DisplayEvent object with the specified source display, type of event, mouse positions where event occurred, and remote flag indicating whether event came from a remote source.

Method Summary
`DisplayEvent` `cloneButDisplay(Display dpy)`
`Display` `getDisplay()`
`protected static Component` `getDisplayComponent(Display d)` get the AWT (including Swing) Component of a Display
`int` `getId()` Get the ID type of this event
`InputEvent` `getInputEvent()` Get the InputEvent associated with this DisplayEvent.
`int` `getKeyCode()` Get the key code for the pressed or released key.
`int` `getModifiers()` Get the keyboard modifiers (such as whether SHIFT or CTRL was being held during the event).
`int` `getX()` Get the horizontal x coordinate for the mouse location.
`int` `getY()` Get the vertical y coordinate for the mouse location.
`String` `toString()` String representation of the event.

Methods inherited from class visad.VisADEvent
`getRemoteId, isRemote`

Methods inherited from class java.awt.Event
`controlDown, metaDown, paramString, shiftDown, translate`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### MOUSE_PRESSED

    public static final int MOUSE_PRESSED

  The "mouse pressed" event. This event occurs when any of the mouse buttons is pressed inside the display. Other MOUSE_PRESSED event positions (LEFT, CENTER, RIGHT) are based on a right-handed mouse configuration.

  See Also:
    Constant Field Values

### TRANSFORM_DONE

    public static final int TRANSFORM_DONE

  The "transform done" event. This even occurs when a DisplayImpl finishes transforming Data into depictions.

  See Also:
    Constant Field Values

### FRAME_DONE

    public static final int FRAME_DONE

  The "frame done" event. This even occurs when Data depictions have been rendered to the screen by the graphics API.

  See Also:
    Constant Field Values

### MOUSE_PRESSED_CENTER

    public static final int MOUSE_PRESSED_CENTER

  The "center mouse button pressed" event. This event occurs when the center mouse button is pressed inside the display.

  See Also:
    Constant Field Values

### MOUSE_PRESSED_LEFT

    public static final int MOUSE_PRESSED_LEFT

  The "left mouse button pressed" event. This event occurs when the left mouse button is pressed inside the display.

  See Also:
    Constant Field Values

### MOUSE_PRESSED_RIGHT

    public static final int MOUSE_PRESSED_RIGHT

  The "right mouse button pressed" event. This event occurs when the right mouse button is pressed inside the display.

  See Also:
    Constant Field Values

### MOUSE_RELEASED

    public static final int MOUSE_RELEASED

  The "mouse released" event. This event occurs when any of the mouse buttons is released after one of the MOUSE_PRESSED events. Other MOUSE_RELEASED event positions (LEFT, CENTER, RIGHT) are based on a right-handed mouse configuration.

  See Also:
    Constant Field Values

### MOUSE_RELEASED_CENTER

    public static final int MOUSE_RELEASED_CENTER

  The "center mouse button released" event. This event occurs when the center mouse button is released after a MOUSE_PRESSED or MOUSE_PRESSED_CENTER event.

  See Also:
    Constant Field Values

### MOUSE_RELEASED_LEFT

    public static final int MOUSE_RELEASED_LEFT

  The "left mouse button released" event. This event occurs when the left mouse button is released after a MOUSE_PRESSED or MOUSE_PRESSED_LEFT event.

  See Also:
    Constant Field Values

### MOUSE_RELEASED_RIGHT

    public static final int MOUSE_RELEASED_RIGHT

  The "right mouse button released" event. This event occurs when the right mouse button is released after a MOUSE_PRESSED or MOUSE_PRESSED_RIGHT event.

  See Also:
    Constant Field Values

### MAP_ADDED

    public static final int MAP_ADDED

  The "map added" event. This event occurs when a ScalarMap is added to the display.

  See Also:
    Constant Field Values

### MAPS_CLEARED

    public static final int MAPS_CLEARED

  The "maps cleared" event. This event occurs when all ScalarMaps are removed from the display.

  See Also:
    Constant Field Values

### REFERENCE_ADDED

    public static final int REFERENCE_ADDED

  The "reference added" event. This event occurs when a DataReference is added to the display.

  See Also:
    Constant Field Values

### REFERENCE_REMOVED

    public static final int REFERENCE_REMOVED

  The "reference removed" event. This event occurs when a DataReference is removed from the display.

  See Also:
    Constant Field Values

### DESTROYED

    public static final int DESTROYED

  The "display destroyed" event. This event occurs when a display's destroy() method is called.

  See Also:
    Constant Field Values

### KEY_PRESSED

    public static final int KEY_PRESSED

  The "key pressed" event. This event occurs when the display has the focus and a key on the keyboard is pressed. Note that a KeyboardBehavior must be attached to the display before this type of event will be reported.

  See Also:
    Constant Field Values

### KEY_RELEASED

    public static final int KEY_RELEASED

  The "key released" event. This event occurs when the display has the focus and a key on the keyboard is released. Note that a KeyboardBehavior must be attached to the display before this type of event will be reported.

  See Also:
    Constant Field Values

### MOUSE_DRAGGED

    public static final int MOUSE_DRAGGED

  The "mouse dragged" event. This event occurs when the mouse is dragged across the display. Note that you must call DisplayImpl.enableEvent(DisplayEvent.MOUSE_DRAGGED) to enable reporting of this type of event.

  See Also:
    Constant Field Values

### MOUSE_ENTERED

    public static final int MOUSE_ENTERED

  The "mouse entered" event. This event occurs when the mouse cursor enters the region of the display. Note that you must call DisplayImpl.enableEvent(DisplayEvent.MOUSE_ENTERED) to enable reporting of this type of event.

  See Also:
    Constant Field Values

### MOUSE_EXITED

    public static final int MOUSE_EXITED

  The "mouse exited" event. This event occurs when the mouse cursor leaves the region of the display. Note that you must call DisplayImpl.enableEvent(DisplayEvent.MOUSE_EXITED) to enable reporting of this type of event.

  See Also:
    Constant Field Values

### MOUSE_MOVED

    public static final int MOUSE_MOVED

  The "mouse moved" event. This event occurs when the mouse is moved across the display. Note that you must call DisplayImpl.enableEvent(DisplayEvent.MOUSE_MOVED) to enable reporting of this type of event.

  See Also:
    Constant Field Values

### WAIT_ON

    public static final int WAIT_ON

  The "display wait on" event. This event occurs when a display's renderer is told to "wait" Note that you must call DisplayImpl.enableEvent(DisplayEvent.WAIT_ON) to enable reporting of this type of event.

  See Also:
    Constant Field Values

### WAIT_OFF

    public static final int WAIT_OFF

  The "display wait off" event. This event occurs when a display's renderer is told to "stop waiting" Note that you must call DisplayImpl.enableEvent(DisplayEvent.WAIT_OFF) to enable reporting of this type of event.

  See Also:
    Constant Field Values

### MAP_REMOVED

    public static final int MAP_REMOVED

  The "map removed" event. This event occurs when a ScalarMap is removed from the display.

  See Also:
    Constant Field Values

### COMPONENT_RESIZED

    public static final int COMPONENT_RESIZED

  The "component resized" event. This event occurs when a the display's component is resized. Note that you must call DisplayImpl.enableEvent(DisplayEvent.COMPONENT_RESIZED) to enable reporting of this type of event.

  See Also:
    Constant Field Values

Constructor Detail

### DisplayEvent

    public DisplayEvent(Display d,
                        int id_d)

  Constructs a DisplayEvent object with the specified source display, and type of event.

Parameters:
  `d` - display that sends the event
  `id_d` - type of DisplayEvent that is sent

### DisplayEvent

    public DisplayEvent(Display d,
                        int id_d,
                        int remoteId)

  Constructs a DisplayEvent object with the specified source display, and type of event.

Parameters:
  `d` - display that sends the event
  `id_d` - type of DisplayEvent that is sent
  `remoteId` - ID of remote source

### DisplayEvent

    public DisplayEvent(Display d,
                        int id_d,
                        int x,
                        int y)

  Constructs a DisplayEvent object with the specified source display, type of event, and mouse positions where event occurred.

Parameters:
  `d` - display that sends the event
  `id_d` - type of DisplayEvent that is sent
  `x` - the horizontal x coordinate for the mouse location in the display component
  `y` - the vertical y coordinate for the mouse location in the display component

### DisplayEvent

    public DisplayEvent(Display d,
                        int id_d,
                        InputEvent e)

  Constructs a DisplayEvent object with the specified source display, type of event, and mouse event describing mouse details.

Parameters:
  `d` - display that sends the event
  `id_d` - type of DisplayEvent that is sent
  `e` - the InputEvent describing this MOUSE type DisplayEvent

### DisplayEvent

    public DisplayEvent(Display d,
                        int id_d,
                        int x,
                        int y,
                        int remoteId)

  Constructs a DisplayEvent object with the specified source display, type of event, mouse positions where event occurred, and remote flag indicating whether event came from a remote source.

Parameters:
  `d` - display that sends the event
  `id_d` - type of DisplayEvent that is sent
  `x` - the horizontal x coordinate for the mouse location in the display component
  `y` - the vertical y coordinate for the mouse location in the display component
  `remoteId` - ID of remote source

### DisplayEvent

    public DisplayEvent(Display d,
                        int id_d,
                        InputEvent e,
                        int remoteId)

  Constructs a DisplayEvent object with the specified source display, type of event, mouse event describing mouse details, and remote flag indicating whether event came from a remote source.

Parameters:
  `d` - display that sends the event
  `id_d` - type of DisplayEvent that is sent
  `e` - the InputEvent describing this MOUSE type DisplayEvent
  `remoteId` - ID of remote source

Method Detail

### getDisplayComponent

    protected static Component getDisplayComponent(Display d)

  get the AWT (including Swing) Component of a Display

  Parameters:
    `d` - the Display
  Returns:
    the Component of d (may be null

### cloneButDisplay

    public DisplayEvent cloneButDisplay(Display dpy)

  Returns:
    a new DisplayEvent which is a copy of this event, but which uses the specified source display

### getDisplay

    public Display getDisplay()

  Returns:
    the DisplayImpl that sent this DisplayEvent (or a RemoteDisplay reference to it if the Display was on a different JVM)

### getId

    public int getId()

  Get the ID type of this event

  Returns:
    DisplayEvent type. Valid types are:
    - DisplayEvent.FRAME_DONE
    - DisplayEvent.TRANSFORM_DONE
    - DisplayEvent.MOUSE_PRESSED
    - DisplayEvent.MOUSE_PRESSED_LEFT
    - DisplayEvent.MOUSE_PRESSED_CENTER
    - DisplayEvent.MOUSE_PRESSED_RIGHT
    - DisplayEvent.MOUSE_RELEASED_LEFT
    - DisplayEvent.MOUSE_RELEASED_CENTER
    - DisplayEvent.MOUSE_RELEASED_RIGHT
    - DisplayEvent.MAP_ADDED
    - DisplayEvent.MAPS_CLEARED
    - DisplayEvent.REFERENCE_ADDED
    - DisplayEvent.REFERENCE_REMOVED
    - DisplayEvent.DESTROYED
    - DisplayEvent.KEY_PRESSED
    - DisplayEvent.KEY_RELEASED
    - DisplayEvent.MOUSE_DRAGGED
    - DisplayEvent.MOUSE_ENTERED
    - DisplayEvent.MOUSE_EXITED
    - DisplayEvent.MOUSE_MOVED
    - DisplayEvent.WAIT_ON
    - DisplayEvent.WAIT_OFF
    - DisplayEvent.MAP_REMOVED
    - DisplayEvent.COMPONENT_RESIZED

### getX

    public int getX()

  Get the horizontal x coordinate for the mouse location. Only valid for MOUSE type events.

  Returns:
    horizontal x coordinate for the mouse location in the display component, or -1 if not a mouse event

### getY

    public int getY()

  Get the vertical y coordinate for the mouse location. Only valid for MOUSE type events.

  Returns:
    vertical y coordinate for the mouse location in the display component, or -1 if not a mouse event

### getKeyCode

    public int getKeyCode()

  Get the key code for the pressed or released key. Only valid for KEY type events.

  Returns:
    key code for key pressed or released in the display component, or -1 if not a key event

### getModifiers

    public int getModifiers()

  Get the keyboard modifiers (such as whether SHIFT or CTRL was being held during the event). Only valid for MOUSE and KEY type events.

  Returns:
    keyboard modifier bit field, or -1 if not a mouse event

### getInputEvent

    public InputEvent getInputEvent()

  Get the InputEvent associated with this DisplayEvent. Only valid for MOUSE and KEY type events.

  Returns:
    associated InputEvent, or null if not a mouse event

### toString

    public String toString()

  String representation of the event.

  Returns:
    descriptive info about the event