FileDocCategorySizeDatePackage
LinkLabel.javaAPI DocAzureus 3.0.3.42846Sun Dec 10 15:37:38 GMT 2006org.gudy.azureus2.ui.swt.components

LinkLabel

public class LinkLabel extends Object

Fields Summary
Constructors Summary
public LinkLabel(org.eclipse.swt.widgets.Composite composite, String resource, String link)

		this( composite, new GridData(), resource, link );
	
public LinkLabel(org.eclipse.swt.widgets.Composite composite, org.eclipse.swt.layout.GridData gridData, String resource, String link)

	    Label linkLabel = new Label(composite, SWT.NULL);
	    Messages.setLanguageText(linkLabel,resource);
	    linkLabel.setLayoutData( gridData );
	    makeLinkedLabel(linkLabel, link);
	
Methods Summary
public static voidmakeLinkedLabel(org.eclipse.swt.widgets.Label label, java.lang.String hyperlink)
Alters a given label to make it appear like a launchable link. This should preferably be done after all other changes have been performed on the label - especially the setting of the label's text.

		label.setData(hyperlink);
		String tooltip = label.getToolTipText();
		
		// We only set a tooltip if one isn't set already and it isn't
		// identical to the label text.
		if (tooltip == null && !hyperlink.equals(label.getText())) {
			label.setToolTipText(hyperlink);
		}
	    label.setCursor(Cursors.handCursor);
	    label.setForeground(Colors.blue);
	    label.addMouseListener(new MouseAdapter() {
	      public void mouseDoubleClick(MouseEvent arg0) {
	      	Utils.launch((String) ((Label) arg0.widget).getData());
	      }
	      public void mouseUp(MouseEvent arg0) {
	      	Utils.launch((String) ((Label) arg0.widget).getData());
	      }
	    });