Class Touch


  • public final class Touch
    extends Object
    Instances of this class are created in response to a touch-based input device being touched. They are found in the touches field of an Event or TouchEvent.
    Since:
    3.7
    See Also:
    TouchEvent, Sample code and further information
    • Field Summary

      Fields 
      Modifier and Type Field Description
      long id
      The unique identity of the touch.
      boolean primary
      A flag indicating that the touch is the first touch from a previous state of no touch points.
      TouchSource source
      The object representing the input source that generated the touch.
      int state
      The state of this touch at the time it was generated.
      int x
      The x location of the touch in TouchSource coordinates.
      int y
      The y location of the touch in TouchSource coordinates.
    • Field Detail

      • id

        public long id
        The unique identity of the touch. Use this value to track changes to a touch during the touch's life. Two touches may have the same identity even if they come from different sources.
      • source

        public TouchSource source
        The object representing the input source that generated the touch.
      • primary

        public boolean primary
        A flag indicating that the touch is the first touch from a previous state of no touch points. Once designated as such, the touch remains the primary touch until all fingers are removed from the device.
      • x

        public int x
        The x location of the touch in TouchSource coordinates.
      • y

        public int y
        The y location of the touch in TouchSource coordinates.
    • Method Detail

      • toString

        public String toString()
        Returns a string containing a concise, human-readable description of the receiver.
        Overrides:
        toString in class Object
        Returns:
        a string representation of the event