0

I have been able to successfully load another java program (Calculator) within a java program with the following code:

Calculator.main(null)

The program loads successfully but both programs have the code:

addWindowListener(
			new WindowAdapter()
			{
				public void windowClosing(WindowEvent e)
				{
					System.exit(0);
				}
			}
		);

So once I close the Calculator program that I loaded within another java program, both programs close, acting like one program, clicking the close button on the window closes everything.

Anyone know how to tell that both programs are separate programs and that closing the window, (exiting) should not let the main program I load close as well?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by JamesCherrill
0

That whole block of code simply tells Java to exit the app when the window is closed, so just remove it or each window that should not call System.exit when it is closed.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.