P
Philipp
Hello
I have a class DataHolder which represents some data and loads it from a
file using its constructor.
The caller code would look like
DataHolder d = new DataHolder(file);
useDataHolder(d);
Now I would like the user to be able to choose some options for the file
being loaded. So inside the DataHolder ctor, I would like to show a
Dialog and _wait_ for it to return. And then get some params from that
Dialog and finish the construction of my DataHolder object.
Now I'm a bit confused on how to do that.
For now the constructor lools like:
public DataHolder(File file){
someStuff();
ParamDialog dialog = new ParamDialog(); // is a JDialog
dialog.setVisible(true);
Param p = dialog.getParam();
otherStuff(p);
}
the code will execute fine but if I'm correct the thread (AWT) will just
continue while the dialog is shown. So Param p is not yet the final
value and otherStuff(p) will be corrupted.
How should I do this?
Thanks for your answers
Philipp
I have a class DataHolder which represents some data and loads it from a
file using its constructor.
The caller code would look like
DataHolder d = new DataHolder(file);
useDataHolder(d);
Now I would like the user to be able to choose some options for the file
being loaded. So inside the DataHolder ctor, I would like to show a
Dialog and _wait_ for it to return. And then get some params from that
Dialog and finish the construction of my DataHolder object.
Now I'm a bit confused on how to do that.
For now the constructor lools like:
public DataHolder(File file){
someStuff();
ParamDialog dialog = new ParamDialog(); // is a JDialog
dialog.setVisible(true);
Param p = dialog.getParam();
otherStuff(p);
}
the code will execute fine but if I'm correct the thread (AWT) will just
continue while the dialog is shown. So Param p is not yet the final
value and otherStuff(p) will be corrupted.
How should I do this?
Thanks for your answers
Philipp