Module qupath.fx

Class InputDisplay

java.lang.Object
qupath.fx.controls.InputDisplay
All Implemented Interfaces:
EventListener, javafx.event.EventHandler<javafx.scene.input.InputEvent>

public class InputDisplay extends Object implements javafx.event.EventHandler<javafx.scene.input.InputEvent>
Control to display mouse and keyboard input when interacting with a window.

This is useful for demos and tutorials where shortcut keys are used.

  • Property Summary

    Properties
    Type
    Property
    Description
    javafx.beans.property.ObjectProperty<javafx.util.Duration>
     
    javafx.beans.property.DoubleProperty
     
    javafx.beans.property.BooleanProperty
    Optionally reverse the scroll direction, both horizontally and vertically.
    javafx.beans.property.BooleanProperty
     
    javafx.beans.property.BooleanProperty
     
    javafx.beans.property.BooleanProperty
    Control whether keypresses are ignored when typing is performed within a text input control (e.g.
  • Constructor Summary

    Constructors
    Constructor
    Description
    InputDisplay(javafx.stage.Window owner)
    Create an input display with the specified owner window.
    InputDisplay(javafx.stage.Window owner, javafx.collections.ObservableList<? extends javafx.stage.Window> windows)
    Create an input display with the specified owner window and list of windows to listen to.
  • Method Summary

    Modifier and Type
    Method
    Description
    javafx.beans.property.ObjectProperty<javafx.util.Duration>
     
    javafx.beans.property.DoubleProperty
     
    javafx.util.Duration
    Gets the value of the fadeDuration property.
    double
    Gets the value of the fadeTo property.
    boolean
    Gets the value of the reverseScroll property.
    boolean
    Gets the value of the showSymbols property.
    boolean
    Gets the value of the skipTextInputControls property.
    void
    handle(javafx.scene.input.InputEvent event)
     
    void
    Hide the input display.
    javafx.beans.property.BooleanProperty
    Optionally reverse the scroll direction, both horizontally and vertically.
    void
    setFadeDuration(javafx.util.Duration duration)
    Sets the value of the fadeDuration property.
    void
    setFadeTo(double opacity)
    Sets the value of the fadeTo property.
    void
    setReverseScroll(boolean doReverse)
    Sets the value of the reverseScroll property.
    void
    setShowSymbols(boolean showSymbols)
    Sets the value of the showSymbols property.
    void
    Sets the value of the skipTextInputControls property.
    void
    Show the input display.
    javafx.beans.property.BooleanProperty
     
    javafx.beans.property.BooleanProperty
     
    javafx.beans.property.BooleanProperty
    Control whether keypresses are ignored when typing is performed within a text input control (e.g.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

  • Constructor Details

    • InputDisplay

      public InputDisplay(javafx.stage.Window owner)
      Create an input display with the specified owner window.
      Parameters:
      owner - the owner used to position the input display, and when listening to input events. If null, an input display is created to listen to all windows but without any owner.
    • InputDisplay

      public InputDisplay(javafx.stage.Window owner, javafx.collections.ObservableList<? extends javafx.stage.Window> windows)
      Create an input display with the specified owner window and list of windows to listen to. To listen to input across all windows, use Window.getWindows().
      Parameters:
      owner - the owner used to position the input display.
      windows - the windows to listen to.
  • Method Details

    • showProperty

      public javafx.beans.property.BooleanProperty showProperty()
      Returns:
      the show property
    • show

      public void show()
      Show the input display.
    • hide

      public void hide()
      Hide the input display.
    • reverseScrollProperty

      public javafx.beans.property.BooleanProperty reverseScrollProperty()
      Optionally reverse the scroll direction, both horizontally and vertically. This exists to support the fact that scrolling can act differently on different platforms, or even different devices using the same platform.

      For example, on macOS there has been a setting for a mouse to use 'natural scrolling' for some years; this also exists for Windows 11, or could previously have been adjusted in registry settings. Unfortunately, we have no way to query this information from Java to 'correct' the scroll directions shown here.

      Returns:
      the reverseScroll property
      See Also:
    • setReverseScroll

      public void setReverseScroll(boolean doReverse)
      Sets the value of the reverseScroll property.
      Property description:
      Optionally reverse the scroll direction, both horizontally and vertically. This exists to support the fact that scrolling can act differently on different platforms, or even different devices using the same platform.

      For example, on macOS there has been a setting for a mouse to use 'natural scrolling' for some years; this also exists for Windows 11, or could previously have been adjusted in registry settings. Unfortunately, we have no way to query this information from Java to 'correct' the scroll directions shown here.

      Parameters:
      doReverse - the value for the reverseScroll property
      See Also:
    • getReverseScroll

      public boolean getReverseScroll()
      Gets the value of the reverseScroll property.
      Property description:
      Optionally reverse the scroll direction, both horizontally and vertically. This exists to support the fact that scrolling can act differently on different platforms, or even different devices using the same platform.

      For example, on macOS there has been a setting for a mouse to use 'natural scrolling' for some years; this also exists for Windows 11, or could previously have been adjusted in registry settings. Unfortunately, we have no way to query this information from Java to 'correct' the scroll directions shown here.

      Returns:
      the value of the reverseScroll property
      See Also:
    • skipTextInputControlsProperty

      public javafx.beans.property.BooleanProperty skipTextInputControlsProperty()
      Control whether keypresses are ignored when typing is performed within a text input control (e.g. text field, text area). Default is false.
      Returns:
      the skipTextInputControls property
      See Also:
    • setSkipTextInputControls

      public void setSkipTextInputControls(boolean skip)
      Sets the value of the skipTextInputControls property.
      Property description:
      Control whether keypresses are ignored when typing is performed within a text input control (e.g. text field, text area). Default is false.
      Parameters:
      skip - the value for the skipTextInputControls property
      See Also:
    • getSkipTextInputControls

      public boolean getSkipTextInputControls()
      Gets the value of the skipTextInputControls property.
      Property description:
      Control whether keypresses are ignored when typing is performed within a text input control (e.g. text field, text area). Default is false.
      Returns:
      the value of the skipTextInputControls property
      See Also:
    • showSymbolsProperty

      public javafx.beans.property.BooleanProperty showSymbolsProperty()
      Returns:
      the showSymbols property
      See Also:
    • setShowSymbols

      public void setShowSymbols(boolean showSymbols)
      Sets the value of the showSymbols property.
      Property description:
      Parameters:
      showSymbols - the value for the showSymbols property
      See Also:
    • getShowSymbols

      public boolean getShowSymbols()
      Gets the value of the showSymbols property.
      Property description:
      Returns:
      the value of the showSymbols property
      See Also:
    • fadeDurationProperty

      public javafx.beans.property.ObjectProperty<javafx.util.Duration> fadeDurationProperty()
      Returns:
      the fadeDuration property
      See Also:
    • setFadeDuration

      public void setFadeDuration(javafx.util.Duration duration)
      Sets the value of the fadeDuration property.
      Property description:
      Parameters:
      duration - the value for the fadeDuration property
      See Also:
    • getFadeDuration

      public javafx.util.Duration getFadeDuration()
      Gets the value of the fadeDuration property.
      Property description:
      Returns:
      the value of the fadeDuration property
      See Also:
    • fadeToProperty

      public javafx.beans.property.DoubleProperty fadeToProperty()
      Returns:
      the fadeTo property
      See Also:
    • setFadeTo

      public void setFadeTo(double opacity)
      Sets the value of the fadeTo property.
      Property description:
      Parameters:
      opacity - the value for the fadeTo property
      See Also:
    • getFadeTo

      public double getFadeTo()
      Gets the value of the fadeTo property.
      Property description:
      Returns:
      the value of the fadeTo property
      See Also:
    • handle

      public void handle(javafx.scene.input.InputEvent event)
      Specified by:
      handle in interface javafx.event.EventHandler<javafx.scene.input.InputEvent>