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


The program loads successfully but both programs have the code:

			new WindowAdapter()
				public void windowClosing(WindowEvent e)

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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.