Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to show another window when login button clicked?
icon5.gif  How to show another window when login button clicked? [message #500118] Wed, 25 November 2009 03:53 Go to next message
iqbal  is currently offline iqbal
Messages: 1
Registered: November 2009
Junior Member
hai all,

i want to show another window when i click login button but, the first window is closed when the second window is show. can you help me please??.
Re: How to show another window when login button clicked? [message #500130 is a reply to message #500118] Wed, 25 November 2009 06:44 Go to previous message
Praveen  is currently offline Praveen
Messages: 86
Registered: July 2009
Member
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 ();
}
Previous Topic:Scrolling problem of TreeViewer while DND
Next Topic:missing first column of a table
Goto Forum:
  


Current Time: Mon Sep 22 04:33:08 GMT 2014

Powered by FUDForum. Page generated in 0.02276 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software