Class Hyperlink

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class Hyperlink extends ButtonBase

An HTML like label which can be a graphic and/or text which responds to rollovers and clicks. When a hyperlink is clicked/pressed isVisited() becomes true. A Hyperlink behaves just like a Button. When a hyperlink is pressed and released a ActionEvent is sent, and your application can perform some action based on this event.

Example:

Hyperlink link = new Hyperlink("www.oracle.com");
Image of the Hyperlink control
Since:
JavaFX 2.0
  • Property Details

  • Constructor Details

    • Hyperlink

      public Hyperlink()
      Creates a hyperlink with no label.
    • Hyperlink

      public Hyperlink(String text)
      Create a hyperlink with the specified text as its label.
      Parameters:
      text - A text string for its label.
    • Hyperlink

      public Hyperlink(String text, Node graphic)
      Create a hyperlink with the specified text and graphic as its label.
      Parameters:
      text - A text string for its label.
      graphic - A graphic for its label
  • Method Details

    • visitedProperty

      public final BooleanProperty visitedProperty()
      Indicates whether this link has already been "visited".
      See Also:
    • setVisited

      public final void setVisited(boolean value)
      Sets the value of the property visited.
      Property description:
      Indicates whether this link has already been "visited".
    • isVisited

      public final boolean isVisited()
      Gets the value of the property visited.
      Property description:
      Indicates whether this link has already been "visited".
    • fire

      public void fire()
      Implemented to invoke the ActionEvent if one is defined. This function will also setVisited(boolean) to true.
      Specified by:
      fire in class ButtonBase
    • getInitialCursor

      protected Cursor getInitialCursor()
      Returns the initial cursor state of this control, for use by the JavaFX CSS engine to correctly set its initial value. This method is overridden to use the HAND cursor initially.
      Overrides:
      getInitialCursor in class Node
      Returns:
      the initial cursor state for this Node.
      Since:
      9