Class InfoOverlay

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class InfoOverlay extends Control
A simple UI control that allows for an information popup to be displayed over a node to describe it in further detail. In some ways, it can be thought of as a always visible tooltip (although by default it is collapsed so only the first line is shown - clicking on it will expand it to show all text).

Shown below is a screenshot of the InfoOverlay control in both its collapsed and expanded states:

Screenshot of InfoOverlay
  • Property Details

  • Constructor Details

    • InfoOverlay

      public InfoOverlay()
      Constructs a default InfoOverlay control with no node or text.
    • InfoOverlay

      public InfoOverlay(String imageUrl, String text)
      Attempts to construct an InfoOverlay instance using the given string to load an image, and to place the given text string over top of it.
      Parameters:
      imageUrl - The image file to attempt to load.
      text - The text to display over top of the image.
    • InfoOverlay

      public InfoOverlay(Node content, String text)
      Constructs an InfoOverlay instance using the given Node (which can be an arbitrarily complex node / scenegraph, or a simple ImageView, for example), and places the given text string over top of it.
      Parameters:
      content - The arbitrarily complex scenegraph over which the text will be displayed.
      text - The text to display over top of the node.
  • Method Details

    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class Control
    • contentProperty

      public final ObjectProperty<Node> contentProperty()
      Returns:
      an ObjectProperty containing the arbitrarily complex scenegraph over which the text will be displayed.
    • setContent

      public final void setContent(Node content)
      Sets a new value for the contentProperty().
      Parameters:
      content -
    • getContent

      public final Node getContent()
      Returns:
      the arbitrarily complex scenegraph over which the text will be displayed.
    • textProperty

      public final StringProperty textProperty()
      See Also:
    • getText

      public final String getText()
      Returns:
      The text displayed over top of the content.
    • setText

      public final void setText(String text)
      Specifies the text to display over top of the content.
      Parameters:
      text -
    • showOnHoverProperty

      public final BooleanProperty showOnHoverProperty()
      See Also:
    • isShowOnHover

      public final boolean isShowOnHover()
      Returns:
      whether the overlay on hover of the content node is showing.
    • setShowOnHover

      public final void setShowOnHover(boolean value)
      Specifies whether to show the overlay on hover of the content node (and to hide it again when the content is no longer being hovered). By default this is true.
      Parameters:
      value -
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class Region
    • getUserAgentStylesheet

      protected final String getUserAgentStylesheet(Class<?> clazz, String fileName)
      A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once. Caches the external form of the resource.
      Parameters:
      clazz - the class used for the resource lookup
      fileName - the name of the user agent stylesheet
      Returns:
      the external form of the user agent stylesheet (the path)