org.zkoss.zk.ui.event
Class MouseEvent

java.lang.Object
  extended by org.zkoss.zk.ui.event.Event
      extended by org.zkoss.zk.ui.event.MouseEvent
Direct Known Subclasses:
DropEvent

public class MouseEvent
extends Event

Represents an event cause by mouse activitly.

There are two possible way to identify a mouse event. One is by coordination (getX() and getY(). The other is by a logical name, called area (getArea()).

Author:
tomyeh

Field Summary
static int ALT_KEY
          Indicates whether the Alt key is pressed.
static int CTRL_KEY
          Indicates whether the Ctrl key is pressed.
static int SHIFT_KEY
          Indicates whether the Shift key is pressed.
 
Constructor Summary
MouseEvent(java.lang.String name, Component target)
          Construct a mouse relevant event with coordination or area.
MouseEvent(java.lang.String name, Component target, int x, int y)
          Constructs a mouse relevant event.
MouseEvent(java.lang.String name, Component target, int x, int y, int keys)
          Constructs a mouse relevant event.
MouseEvent(java.lang.String name, Component target, java.lang.String area)
          Constructs a mouse relevant event with a logic name called area.
 
Method Summary
 java.lang.String getArea()
          Returns the logical name of the area that the click occurs, or null if not available.
 int getKeys()
          Returns what keys were pressed when the mouse is clicked, or 0 if none of them was pressed.
 int getX()
          Returns the x coordination of the mouse pointer relevant to the component.
 int getY()
          Returns the y coordination of the mouse pointer relevant to the component.
 
Methods inherited from class org.zkoss.zk.ui.event.Event
getData, getName, getPage, getTarget, isPropagatable, stopPropagation, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALT_KEY

public static final int ALT_KEY
Indicates whether the Alt key is pressed. It might be returned as part of getKeys().

See Also:
Constant Field Values

CTRL_KEY

public static final int CTRL_KEY
Indicates whether the Ctrl key is pressed. It might be returned as part of getKeys().

See Also:
Constant Field Values

SHIFT_KEY

public static final int SHIFT_KEY
Indicates whether the Shift key is pressed. It might be returned as part of getKeys().

See Also:
Constant Field Values
Constructor Detail

MouseEvent

public MouseEvent(java.lang.String name,
                  Component target)
Construct a mouse relevant event with coordination or area.


MouseEvent

public MouseEvent(java.lang.String name,
                  Component target,
                  int x,
                  int y)
Constructs a mouse relevant event.


MouseEvent

public MouseEvent(java.lang.String name,
                  Component target,
                  int x,
                  int y,
                  int keys)
Constructs a mouse relevant event.

Parameters:
keys - a combination of CTRL_KEY, SHIFT_KEY and ALT_KEY.

MouseEvent

public MouseEvent(java.lang.String name,
                  Component target,
                  java.lang.String area)
Constructs a mouse relevant event with a logic name called area.

Method Detail

getArea

public java.lang.String getArea()
Returns the logical name of the area that the click occurs, or null if not available.

It is used only with some special components, such as imagemap, that partition itself into several logical areas.


getX

public final int getX()
Returns the x coordination of the mouse pointer relevant to the component.


getY

public final int getY()
Returns the y coordination of the mouse pointer relevant to the component.


getKeys

public final int getKeys()
Returns what keys were pressed when the mouse is clicked, or 0 if none of them was pressed. It is a combination of CTRL_KEY, SHIFT_KEY and ALT_KEY.



Copyright © 2005-2007 Potix Corporation. All Rights Reserved.