SWT widget not displayed [message #502848] |
Wed, 09 December 2009 17:44  |
Eclipse User |
|
|
|
Hi,
I am writing an Eclipse plug-in which launches an SWT widget. Here's what I'm writing:
public void run(IAction action) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Button Example");
shell.setBounds(100, 100, 200, 100);
shell.setLayout(new FillLayout());
final Button button = new Button(shell, SWT.PUSH);
button.setText("Click Me Now");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
button.setText("I Was Clicked");
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Although the window is displayed ok when placed in the main method of a java application, over here it isn't working. Can anyone help me please?
Thanks and regards,
Kurt
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.11952 seconds