anticipo una possibile soluzione usando la reflection, così mi magari mi dite se può andare:
codice:
public class BackgroundOperation extends SwingWorker<Void, Void> {
private String frame;
private String method;
private JDialog dialog;
public BackgroundOperation(String frame, String method, JDialog dialog) {
this.frame = frame;
this.method = method;
this.dialog = dialog;
}
@Override
protected Void doInBackground() throws Exception {
Class noparams[] = {};
Class cls = Class.forName(frame);
Object obj = cls.newInstance();
Method m = cls.getDeclaredMethod(method, noparams);
m.invoke(obj, null);
return null;
}
@Override
protected void done() {
dialog.dispose();
}
}