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
    • Constructor Detail

      • 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 Detail

      • 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".
      • createDefaultSkin

        protected Skin<?> createDefaultSkin()
        Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).
        Overrides:
        createDefaultSkin in class Control
        Returns:
        new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
      • 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
      • queryAccessibleAttribute

        public Object queryAccessibleAttribute​(AccessibleAttribute attribute,
                                               Object... parameters)
        This method is called by the assistive technology to request the value for an attribute.

        This method is commonly overridden by subclasses to implement attributes that are required for a specific role.
        If a particular attribute is not handled, the superclass implementation must be called.

        Overrides:
        queryAccessibleAttribute in class Control
        Parameters:
        attribute - the requested attribute
        parameters - optional list of parameters
        Returns:
        the value for the requested attribute
        See Also:
        AccessibleAttribute