A
Andreas Thiele
Hi,
I defined a JDialog class ConnectionChooser from which the user can select a
database connection. Invocation should be similar to
JFileChooser.showOpenDialog(). Thus my class contains the following method
which works fine:
public SheetConnection showConnectDialog() {
this.setModal(true);
this.setVisible(true);
this.dispose();
return this.sheetConnection;
}
This method displays the dialog and waits until the user selects a
connection to return an encapsulating object to the caller.
Now this looks somehow dirty to me. I dispose the current object and
afterwards I access one of its member variables to return it to the caller.
Is this technique OK? Is dispose posted to an event queue and thus executed
later (after leaving the method)? Obviously dispose is not executed directly
because in this case I should have received some run time error?
Any hints appreciated
Andreas
I defined a JDialog class ConnectionChooser from which the user can select a
database connection. Invocation should be similar to
JFileChooser.showOpenDialog(). Thus my class contains the following method
which works fine:
public SheetConnection showConnectDialog() {
this.setModal(true);
this.setVisible(true);
this.dispose();
return this.sheetConnection;
}
This method displays the dialog and waits until the user selects a
connection to return an encapsulating object to the caller.
Now this looks somehow dirty to me. I dispose the current object and
afterwards I access one of its member variables to return it to the caller.
Is this technique OK? Is dispose posted to an event queue and thus executed
later (after leaving the method)? Obviously dispose is not executed directly
because in this case I should have received some run time error?
Any hints appreciated
Andreas