how to create a "child" frame.
Standard disclaimer: I'm new to Java especially to AWT/SWING.
In developing my project I realized that I couldn't create a GUI until I had read data from a file. Since I had only created one Java Gui I created one as a class that implemented a file chooser. It had one button: "Browse". When this worked as I wished I started on step two.
For initial development I created a class with a main and used a fixed pathname to facilitate debugging. I used the pathname to access the file and used the data found there to construct from 1 though n JLables and JTextFields.
When this worked I invoked this class from its public method from the class with the browse button and continued development. It all works now *almost* correctly! The only bug is that when I close the second GUI the first closes as well which I don't want.
My question is: how do I build and display a "child" GUI from a "parent" GUI correctly?
Code similar to this appears in both GUIs.
Code:
private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});