Class MouseOverEvent


public class MouseOverEvent extends MouseEvent
Represents a mouse enter event that occurs when the mouse pointer enters an element's boundaries.

This event is fired when the mouse pointer moves from outside an element to inside its boundaries. It extends MouseEvent to inherit coordinate tracking capabilities and is dispatched to registered MouseListener instances for processing. This event is commonly used to implement hover effects or to trigger actions when the user's mouse enters an interactive area.

Features:

  • Detects when mouse pointer enters an element
  • Inherits X and Y coordinate tracking from MouseEvent
  • Complements MouseOutEvent for enter/exit tracking
  • Integrates with the mouse event listener pattern

Usage:


 // Create a mouse over event at coordinates (250, 350)
 MouseOverEvent event = new MouseOverEvent(250, 350);

 // Access inherited coordinate getters
 int x = event.getClientX(); // Returns 250
 int y = event.getClientY(); // Returns 350

 // Dispatch to a listener to handle hover-in effects
 event.dispatchTo(myMouseListener);
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • MouseOverEvent

      public MouseOverEvent(int clientX, int clientY)
      Constructs a new MouseOverEvent with the specified client coordinates.
      Parameters:
      clientX - the X coordinate of the mouse pointer relative to the client viewport
      clientY - the Y coordinate of the mouse pointer relative to the client viewport
  • Method Details

    • dispatchTo

      public void dispatchTo(MouseClickListener listener)
      Dispatches this event to the specified listener for processing.

      This method invokes the listener's onEvent method with this event instance, allowing the listener to handle the mouse enter event.

      Specified by:
      dispatchTo in class Event<MouseClickListener>
      Parameters:
      listener - the listener to which this event should be dispatched