Class TLcdTouchDevice

java.lang.Object
com.luciad.input.touch.TLcdTouchDevice

public class TLcdTouchDevice extends Object
This singleton represents the built-in multi-touch support of LuciadLightspeed. Touch events are supported for Swing applications in Windows 7 and higher.

JavaFX applications have native touch support and should not use this class.

Call getInstance() to load the native driver and use getTouchDeviceStatus() to find out at runtime if touch events are supported.

This class contains some important touch related properties. For each of these properties a getter and setter is available. PropertyChangeListeners can be attached and removed.

The following system properties can be used to tweak the behavior of the native driver:

  • -Dcom.luciad.input.touch.windows.loadNativeDriver=false : never load the native driver.
    This can be useful if you create your own touch events. The default is true.
  • -Dcom.luciad.input.touch.windows.requireMultiTouch=true : do not load the native driver if the touch device does not support multi-touch.
    The default is false.
Since:
10.0
  • Method Details

    • getInstance

      public static TLcdTouchDevice getInstance()
      Initializes the touch support and returns the singleton instance of this class.
      Returns:
      the singleton instance of this class.
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener aListener)
      Add a PropertyChangeListener to the listener list. The listener is registered for all properties. The same listener object may be added more than once, and will be called as many times as it is added. If aListener is null, no exception is thrown and no action is taken.
      Parameters:
      aListener - The PropertyChangeListener to be added
      See Also:
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener aListener)
      Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. If aListener was added more than once to the same event source, it will be notified one less time after being removed. If aListener is null, or was never added, no exception is thrown and no action is taken.
      Parameters:
      aListener - The PropertyChangeListener to be removed
      See Also:
    • getDoubleTapDistanceThreshold

      public int getDoubleTapDistanceThreshold()
      Returns the maximum allowed distance in either the X or Y direction between two successive TOUCH_DOWNs to be considered as a double-tap.
      Returns:
      the maximum allowed distance in either the X or Y direction between two successive TOUCH_DOWNs to be considered as a double-tap, expressed in pixels.
      See Also:
    • setDoubleTapDistanceThreshold

      public void setDoubleTapDistanceThreshold(int aDoubleTapDistanceThreshold)

      When the touch device is touched multiple times rapidly after each other at the same location, the tap count of the corresponding TLcdTouchPoint will increase (similar to double-click with a mouse). This setter allows to specify the maximum difference in either the X or Y direction between two successive TOUCH_DOWNs. If the difference in location between those two TOUCH_DOWNs in either the X or Y direction is greater than aDoubleTapThreshold, the tap count of the corresponding TLcdTouchPoint will not be increased.

      Parameters:
      aDoubleTapDistanceThreshold - the threshold, expressed in pixels
      See Also:
    • getDoubleTapTimeOut

      public int getDoubleTapTimeOut()
      Returns the maximum allowed time between two successive TOUCH_DOWNs to be considered as a double-tap.
      Returns:
      the maximum allowed time between two successive TOUCH_DOWNs to be considered as a double-tap, expressed in milliseconds.
      See Also:
    • setDoubleTapTimeOut

      public void setDoubleTapTimeOut(int aDoubleTapTimeOut)

      When the touch device is touched multiple times rapidly after each other at the same location, the tap count of the corresponding TLcdTouchPoint will increase (similar to double-click with a mouse). This setter allows to specify the maximum allowed delay between two successive TOUCH_DOWNs. If the delay between two TOUCH_DOWNs is higher then aDoubleTapDelay, the tap count of the corresponding TLcdTouchPoint will not be increased.

      Note that his delay is also used when determining whether the tap count should be increased from 2 to 3, from 3 to 4, ... .

      Parameters:
      aDoubleTapTimeOut - the delay, expressed in milliseconds
      See Also:
    • getTouchDeviceStatus

      public TLcdTouchDevice.Status getTouchDeviceStatus()
      Returns the status of the physical touch device. See for a human readable error message
      Returns:
      the status of the physical touch device
    • getTouchDeviceNotReadyMessage

      public String getTouchDeviceNotReadyMessage()
      Returns a human readable explanation of why the touch device is not ready.
      Returns:
      an error message if the touch device is not ready, or null if the touch device is ready
      Since:
      2017.0