I’ve a problem with a Java Project, using SWT library. It’s my first time trying with SWT, so don’t throw stones to me please.
Environment: Eclipse – Juno
Class and functions:
1º Client -> Where’s “main”. Creates a object of “GUI_Creator” class (mine).
2º GUI_Creator -> Has 2 functions, in order to “desing” my forms.
2.1 -> MakeLogIn -> Void method, wich adds the controls i need to the Shell i give him as parameter. I use it, to desing the first form i show to the user.
This function also link the “click” event of a button of this shell, with the second function of GUI_Creator class, that creates a new one shell. Then, this shell would be open, and first one would be closed.
2.2 -> MakeClient -> This function returns a shell var. For me, this returns the second shell of my program, even with the desing, etc.
Problem:
I’m using, at the end of “main” this code:
while (!Conexion.isDisposed())
{
if (!ourDisplay.readAndDispatch())
ourDisplay.sleep();
}
ourDisplay.dispose();
If i’m not wrong, this code is doing that when i try to close my first shell, and then leave only opened the second shell, my program closes completely, because i’m disposing the parent display.
However, i can’t delete this code, because if i do this, when i run my program, it doesn’t “wait” an action, and just executes all “main” code and then closes the GUI and the program finalizes.
So, i really don’t know what would i have to do, in order to fix this situation.
Thanks,
Btc
I’m not sure if I got your problem right, but you could try: