I have a Java swing launcher to run another class (with its main method). Each program has a cancel button to exit it.
I use the System.exit(0);cancel button when I click this.
The launcher launches this at actionPerformed:
if (source==carMenuItem) {
ta.append("Car launched\n");
TestCar.main(par);
}
if (source==DialogboxMenuItem) {
ta.append("Dialogbox launched\n");
DialogBox.main(par);
}
if (source==LengthConversionMenuItem) {
ta.append("LengthConversion launched\n");
LengthConversion.main(par);
}
When I press the cancel button, it also closes my launcher. How can I avoid this situation?
source
share