-
Notifications
You must be signed in to change notification settings - Fork 4
/
CLabelExample.java
80 lines (54 loc) · 2.04 KB
/
CLabelExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package org.eclipse.swt.CLabel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import com.xored.q7.quality.mockups.issues.BaseMockupPart;
public class CLabelExample extends BaseMockupPart {
@Override
public Control construct(Composite parent) {
// TODO Auto-generated method stub
final Text t = new Text(parent, SWT.MULTI | SWT.LEFT);
t.setText("no events");
CLabel l = new CLabel(parent, SWT.LEFT);
l.setText("This is my CLabel");
l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
l.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_GRAY));
l.addMouseListener(new MouseListener(){
public void mouseDoubleClick(MouseEvent e) {
saySomething("Mouse double clicked");
}
public void mouseDown(MouseEvent e) {
saySomething("CLabelDown");
}
public void mouseUp(MouseEvent e) {
saySomething("CLabelUp");
}
void saySomething(String eventDescription) {
t.setText(eventDescription);
}
});
Label label = new Label (parent, SWT.LEFT);
label.setText("This is simple Label");
label.addMouseListener(new MouseListener(){
public void mouseDoubleClick(MouseEvent e) {
saySomething("Mouse double clicked");
}
public void mouseDown(MouseEvent e) {
saySomething("LabelDown");
}
public void mouseUp(MouseEvent e) {
saySomething("LabelUp");
}
void saySomething(String eventDescription) {
t.setText(eventDescription);
}
});
return null;
}
}