blob: ceac3ea4b29c00f086f9872bcf679802afd3fc10 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
<HEAD>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css">
<TITLE>
Hyperlink control
</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>
Hyperlink control</H1>
<p>Hyperlink is a custom widget created to complement the standard SWT widget
set when used in the context of UI Forms. Hyperlink is a selectable text control
that acts like a Web browser hyperlink:</p>
<pre> Hyperlink link = toolkit.createHyperlink(form.getBody(), &quot;Click here.&quot;,
SWT.WRAP);
link.addHyperlinkListener(new HyperlinkAdapter() {
public void linkActivated(HyperlinkEvent e) {
System.out.println(&quot;Link activated!&quot;);
}
});
link.setText(&quot;A sample link&quot;);</pre>
<p>Hyperlinks fire <code>HyperlinkEvent</code> objects when users interact with
them. By adding a <code>HyperlinkListener</code>, clients can capture when the
mouse enters and exits the link, as well as activates it (either by mouse click
or by 'Enter' key).</p>
<p>Hyperlinks created by the form toolkit are automatically inserted into a <b>
hyperlink group</b>. <code>HyperlinkGroup</code> manages common hyperlink
properties like normal and hover foreground color, underline style etc. for all
the links that belong to the group.</p>
<p>Since many hyperlinks are combined with a small image, UI Forms provide a
subclass called <code>ImageHyperlink</code> that add the ability to combine text
and image in one clickable control. This class can also be used when a hyperlink
image (without text) is needed. If image is not set, <code>ImageHyperlink</code>
behaves identically to <code>Hyperlink</code>.</p>
</BODY>
</HTML>