Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: bd8f228cbdc678cb53ef38e4b1d0a5ea5054f625 (plain) (blame)
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
package grant;

import org.eclipse.swt.widgets.*;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.custom.*;

public class FormatterProblem {

public static void main(String args[]) {
new FormatterProblem().buildGUI();
}

private void buildGUI() {
Shell shell = new Shell();
final Display d = shell.getDisplay();
shell.setBounds(100, 100, 300, 100);
shell.setLayout(new GridLayout());
Composite buttonGroup = new Composite(shell, SWT.BORDER);
buttonGroup.setLayout(new GridLayout());
buttonGroup.setLayoutData(new GridData());
final Button addButton = new Button(buttonGroup, SWT.PUSH);
addButton.setLayoutData(new GridData());
SelectionAdapter buttonSelection = new SelectionAdapter() {
//....
};
addButton.addSelectionListener(buttonSelection);

shell.open();
		
while (!shell.isDisposed()) {
if (!d.readAndDispatch())
d.sleep();
}
}
}

Back to the top