I don't know if there is but you can get around that by writing the code. Somethinf like this:
class Foo {
// other methods
public void run() {
loop {
restart(); // performs initialisation
// other method calls
// when program or game finishes you go around the loop again
// or exit depending upon user choice
}
}
public static void main(String[] args) {
Foo f = new Foo();
f.run();
}
}
yeah, my problem is that my code just ends in a different class than the original one.
I have a main method call a class, and then a method in that class calls a class . In that class, I have
class Task extends SwingWorker<Void, Void> {
@Override
public Void doInBackground(){
//lots and lots of code.....
}
@Override
public void done() {
JOptionPane.showMessageDialog(null, "There were " + errors + " errors found", "Errors", JOptionPane.ERROR_MESSAGE);
//System.exit(0);
}
}
I think the code just stops where I have System.exit commented out. If I call the first class again, it just puts it over the first one(which never goes away).
I'm having some difficulty w/ it.... although its not the end of the world if the user has to manually restart the program.