Class TapEvent


public class TapEvent extends TouchEvent
Represents a tap gesture event that occurs when a user performs a quick touch and release on a touch-enabled device.

This event is fired when the user briefly touches and releases a point on a touch surface, similar to a click on traditional pointer devices. It extends TouchEvent as it is part of the touch interaction framework and is dispatched to registered TouchListener instances for processing. This event is the primary means of selection and activation on touch-enabled interfaces.

Features:

  • Detects tap gestures on touch devices
  • Part of the touch event framework
  • Equivalent to click events on traditional interfaces
  • Integrates with the touch event listener pattern

Usage:


 // Create a tap event
 TapEvent event = new TapEvent();

 // Dispatch to a listener to handle tap gestures
 event.dispatchTo(myTouchListener);

 // Common use case: button activation
 public void onEvent(TapEvent event) {
     System.out.println("Element tapped");
     activateButton();
 }
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • TapEvent

      public TapEvent()
  • Method Details

    • dispatchTo

      public void dispatchTo(TouchListener 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 tap gesture, such as activating buttons or selecting items.

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