Originally posted by: unknown.domain.com
I have made a "close" button. My close button is supposed to close the
window and open another one. How can I do this? Here is my code:
btnExit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent arg0)
{
doClose();
}
});
shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(final DisposeEvent arg0) {
doClose();
}
});
private void doClose() {
shell.dispose();
new MainWindow();
}
When I use the "X" button in the window's top-right corner, the window
closes properly and everything is good. However, when I close the window
using my Close button, the window does not close properly. I'm assuming
it's because I call new MainWindow() after shell.dispose(). But if I call
new MainWindow() before shell.dispose() my window will never close.
Any help?