Class Hyperlink

  • All Implemented Interfaces:
    Direct Known Subclasses:

    public class Hyperlink
    extends AbstractHyperlink
    Hyperlink is a concrete implementation of the abstract base class that draws text in the client area. Text can be wrapped and underlined. Hyperlink is typically added to the hyperlink group so that certain properties are managed for all the hyperlinks that belong to it.

    Hyperlink can be extended.

    See Also:
    • Constructor Detail

      • Hyperlink

        public Hyperlink​(Composite parent,
                         int style)
        Creates a new hyperlink control in the provided parent.
        parent - the control parent
        style - the widget style
    • Method Detail

      • initAccessible

        protected void initAccessible()
      • setUnderlined

        public void setUnderlined​(boolean underlined)
        Sets the underlined state. It is not necessary to call this method when in a hyperlink group.
        underlined - if true , a line will be drawn below the text for each wrapped line.
      • isUnderlined

        public boolean isUnderlined()
        Returns the underline state of the hyperlink.
        true if text is underlined, false otherwise.
      • computeSize

        public Point computeSize​(int wHint,
                                 int hHint,
                                 boolean changed)
        Overrides the parent by incorporating the margin.
        computeSize in class Control
        wHint - the width hint (can be SWT.DEFAULT)
        hHint - the height hint (can be SWT.DEFAULT)
        changed - true if the control's contents have changed, and false otherwise
        the preferred size of the control.
        See Also:
        Layout, Control.getBorderWidth(), Control.getBounds(), Control.getSize(), Control.pack(boolean), "computeTrim, getClientArea for controls that implement them"
      • getToolTipText

        public String getToolTipText()
        Description copied from class: Control
        Returns the receiver's tool tip text, or null if it has not been set.
        getToolTipText in class Control
        the receiver's tool tip text
      • setToolTipText

        public void setToolTipText​(String string)
        Description copied from class: Control
        Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown. For a control that has a default tool tip, such as the Tree control on Windows, setting the tool tip text to an empty string replaces the default, causing no tool tip text to be shown.

        The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string.

        NOTE: This operation is a hint and behavior is platform specific, on Windows for CJK-style mnemonics of the form " (&C)" at the end of the tooltip text are not shown in tooltip.

        setToolTipText in class Control
        string - the new tool tip text (or null)
      • setText

        public void setText​(String text)
        Sets the text of this hyperlink.
        text - the hyperlink text
      • paintHyperlink

        protected void paintHyperlink​(GC gc)
        Paints the hyperlink text.
        Specified by:
        paintHyperlink in class AbstractHyperlink
        gc - graphic context
      • paintText

        protected void paintText​(GC gc,
                                 Rectangle bounds)
        Paints the hyperlink text in provided bounding rectangle.
        gc - graphic context
        bounds - the bounding rectangle in which to paint the text
      • shortenText

        protected String shortenText​(GC gc,
                                     String t,
                                     int width)
      • computeTextSize

        protected Point computeTextSize​(int wHint,
                                        int hHint)