JavaScript is disabled on your browser.
Skip navigation links
org.htmlunit.javascript.host.event

Class MouseEvent

    • Field Detail

      • MOZ_SOURCE_UNKNOWN

        public static final int MOZ_SOURCE_UNKNOWN
        Constant for MOZ_SOURCE_UNKNOWN.
        See Also:
        Constant Field Values
      • MOZ_SOURCE_MOUSE

        public static final int MOZ_SOURCE_MOUSE
        Constant for MOZ_SOURCE_MOUSE.
        See Also:
        Constant Field Values
      • MOZ_SOURCE_PEN

        public static final int MOZ_SOURCE_PEN
        Constant for MOZ_SOURCE_PEN.
        See Also:
        Constant Field Values
      • MOZ_SOURCE_ERASER

        public static final int MOZ_SOURCE_ERASER
        Constant for MOZ_SOURCE_ERASER.
        See Also:
        Constant Field Values
      • MOZ_SOURCE_CURSOR

        public static final int MOZ_SOURCE_CURSOR
        Constant for MOZ_SOURCE_CURSOR.
        See Also:
        Constant Field Values
      • MOZ_SOURCE_TOUCH

        public static final int MOZ_SOURCE_TOUCH
        Constant for MOZ_SOURCE_TOUCH.
        See Also:
        Constant Field Values
      • MOZ_SOURCE_KEYBOARD

        public static final int MOZ_SOURCE_KEYBOARD
        Constant for MOZ_SOURCE_KEYBOARD.
        See Also:
        Constant Field Values
      • TYPE_CLICK

        public static final String TYPE_CLICK
        The click event type, triggered by onclick event handlers.
        See Also:
        Constant Field Values
      • TYPE_DBL_CLICK

        public static final String TYPE_DBL_CLICK
        The dblclick event type, triggered by ondblclick event handlers.
        See Also:
        Constant Field Values
      • TYPE_MOUSE_OVER

        public static final String TYPE_MOUSE_OVER
        The mouse over event type, triggered by onmouseover event handlers.
        See Also:
        Constant Field Values
      • TYPE_MOUSE_MOVE

        public static final String TYPE_MOUSE_MOVE
        The mouse move event type, triggered by onmousemove event handlers.
        See Also:
        Constant Field Values
      • TYPE_MOUSE_OUT

        public static final String TYPE_MOUSE_OUT
        The mouse out event type, triggered by onmouseout event handlers.
        See Also:
        Constant Field Values
      • TYPE_MOUSE_DOWN

        public static final String TYPE_MOUSE_DOWN
        The mouse down event type, triggered by onmousedown event handlers.
        See Also:
        Constant Field Values
      • TYPE_MOUSE_UP

        public static final String TYPE_MOUSE_UP
        The mouse up event type, triggered by onmouseup event handlers.
        See Also:
        Constant Field Values
      • TYPE_CONTEXT_MENU

        public static final String TYPE_CONTEXT_MENU
        The context menu event type, triggered by oncontextmenu event handlers.
        See Also:
        Constant Field Values
      • BUTTON_LEFT

        public static final int BUTTON_LEFT
        The code for left mouse button.
        See Also:
        Constant Field Values
      • BUTTON_MIDDLE

        public static final int BUTTON_MIDDLE
        The code for middle mouse button.
        See Also:
        Constant Field Values
      • BUTTON_RIGHT

        public static final int BUTTON_RIGHT
        The code for right mouse button.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MouseEvent

        public MouseEvent()
        Used to build the prototype.
      • MouseEvent

        public MouseEvent(DomNode domNode,
         String type,
         boolean shiftKey,
         boolean ctrlKey,
         boolean altKey,
         int button,
         int detail)
        Creates a new event instance.
        Parameters:
        domNode - the DOM node that triggered the event
        type - the event type
        shiftKey - true if SHIFT is pressed
        ctrlKey - true if CTRL is pressed
        altKey - true if ALT is pressed
        button - the button code, must be BUTTON_LEFT, BUTTON_MIDDLE or BUTTON_RIGHT
        detail - the detail value
    • Method Detail

      • getClientX

        public int getClientX()
        The horizontal coordinate at which the event occurred relative to the DOM implementation's client area.
        Returns:
        the horizontal coordinate
      • setClientX

        public void setClientX(int value)
        Sets the clientX value.
        Parameters:
        value - the clientX value
      • getScreenX

        public int getScreenX()
        The horizontal coordinate at which the event occurred relative to the origin of the screen coordinate system. The value of this attribute is initialized lazily, in order to optimize performance (it requires CSS parsing).
        Returns:
        the horizontal coordinate
      • getPageX

        public int getPageX()
        Returns the horizontal coordinate of the event relative to whole document.
        Returns:
        the horizontal coordinate (currently the same as getScreenX())
        See Also:
        Mozilla doc
      • getClientY

        public int getClientY()
        The vertical coordinate at which the event occurred relative to the DOM implementation's client area.
        Returns:
        the horizontal coordinate
      • setClientY

        public void setClientY(int value)
        Sets the clientY value.
        Parameters:
        value - the clientY value
      • getScreenY

        public int getScreenY()
        The vertical coordinate at which the event occurred relative to the origin of the screen coordinate system. The value of this attribute is initialized lazily, in order to optimize performance (it requires CSS parsing).
        Returns:
        the vertical coordinate
      • getPageY

        public int getPageY()
        Returns the vertical coordinate of the event relative to the whole document.
        Returns:
        the horizontal coordinate (currently the same as getScreenY())
        See Also:
        Mozilla doc
      • getButton

        public int getButton()
        Gets the button code.
        Returns:
        the button code
      • setButton

        public void setButton(int value)
        Sets the button code.
        Parameters:
        value - the button code
      • getButtons

        public int getButtons()
        Gets the button code.
        Returns:
        the button code
      • setButtons

        public void setButtons(int value)
        Sets the button code.
        Parameters:
        value - the button code
      • initMouseEvent

        public void initMouseEvent(String type,
         boolean bubbles,
         boolean cancelable,
         Object view,
         int detail,
         int screenX,
         int screenY,
         int clientX,
         int clientY,
         boolean ctrlKey,
         boolean altKey,
         boolean shiftKey,
         boolean metaKey,
         int button,
         Object relatedTarget)
        Implementation of the DOM Level 2 Event method for initializing the mouse event.
        Parameters:
        type - the event type
        bubbles - can the event bubble
        cancelable - can the event be canceled
        view - the view to use for this event
        detail - the detail to set for the event
        screenX - the initial value of screenX
        screenY - the initial value of screenY
        clientX - the initial value of clientX
        clientY - the initial value of clientY
        ctrlKey - is the control key pressed
        altKey - is the alt key pressed
        shiftKey - is the shift key pressed
        metaKey - is the meta key pressed
        button - what mouse button is pressed
        relatedTarget - is there a related target for the event
      • getCurrentMouseEvent

        public static MouseEvent getCurrentMouseEvent()
        Returns the mouse event currently firing, or null if no mouse event is being processed.
        Returns:
        the mouse event currently firing
      • isMouseEvent

        public static boolean isMouseEvent(String type)
        Returns true if the specified event type should be managed as a mouse event.
        Parameters:
        type - the type of event to check
        Returns:
        true if the specified event type should be managed as a mouse event
      • isAltKey

        public boolean isAltKey()
        Returns whether ALT has been pressed during this event or not. Overridden to modify browser configurations.
        Overrides:
        isAltKey in class Event
        Returns:
        whether ALT has been pressed during this event or not
      • isCtrlKey

        public boolean isCtrlKey()
        Returns whether CTRL has been pressed during this event or not. Overridden to modify browser configurations.
        Overrides:
        isCtrlKey in class Event
        Returns:
        whether CTRL has been pressed during this event or not
      • isShiftKey

        public boolean isShiftKey()
        Returns whether SHIFT has been pressed during this event or not. Overridden to modify browser configurations.
        Overrides:
        isShiftKey in class Event
        Returns:
        whether SHIFT has been pressed during this event or not
      • processLabelAfterBubbling

        public boolean processLabelAfterBubbling()
        INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
        If we click on a label, we have to simulate a click on the element referenced by the 'for' attribute also. To support this for special events we have this method here. Overridden take care of click events.
        Overrides:
        processLabelAfterBubbling in class Event
        Returns:
        false in this default impl
      • disableProcessLabelAfterBubbling

        public void disableProcessLabelAfterBubbling()
        Disable the lable processing if we are already processing one.
      • getMetaKey

        public boolean getMetaKey()
        Returns whether or not the "meta" key was pressed during the event firing.
        Returns:
        whether or not the "meta" key was pressed during the event firing
      • setMetaKey

        protected void setMetaKey(boolean metaKey)
        Parameters:
        metaKey - whether Meta has been pressed during this event or not
Skip navigation links

Copyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.

AltStyle によって変換されたページ (->オリジナル) /