|
Re: How to show another window when login button clicked? [message #500130 is a reply to message #500118] |
Wed, 25 November 2009 01:44  |
Eclipse User |
|
|
|
Please verify whether the below snippet (or similar code) helps your case -
public static void main (String [] args) {
Display display = new Display ();
final Shell shell = new Shell (display);
final Shell shell2 = new Shell (display);
shell.setLayout(new FillLayout());
Button bt = new Button(shell,SWT.None);
bt.setText("Login");
shell.pack();
shell.open ();
bt.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
shell2.setLayout(new FillLayout());
Label lbl = new Label(shell2,SWT.None);
lbl.setText("Another shell");
shell2.pack();
shell2.open ();
shell.close();
}
});
while (!shell.isDisposed () || !shell2.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
|
|
|
Powered by
FUDForum. Page generated in 0.23909 seconds