-
Notifications
You must be signed in to change notification settings - Fork 12
ClickableLabel
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.
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.");
}
});
An example is located in the source repository:
src/test/java/com/github/haixing_hu/swt/label/ClickableLabelExample.java