Skip to content
Haixing Hu edited this page Sep 13, 2014 · 1 revision

The ClickableLabel is a extention of the standard SWT Label widget, with the support of the mouse single click event.

Usage

Screen Shot of the Header Widget

final ClickableLabel label = new ClickableLabel(shell, SWT.NONE);
label.setText("Click this label to display a balloon window.");
label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
label.addSelectionListener(new SelectionListener() {
  @Override
  public void widgetSelected(SelectionEvent e) {
    onClick();
  }
  @Override
  public void widgetDefaultSelected(SelectionEvent e) {
    onClick();
  }
  private void onClick() {
    Dialog.inform("Click Event", "The label has been clicked.");
  }
});	

Example

An example is located in the source repository:

src/test/java/com/github/haixing_hu/swt/label/ClickableLabelExample.java
Clone this wiki locally