diff --git a/src/FirstGUI.java b/src/FirstGUI.java index 30dc3aa..03cd114 100644 --- a/src/FirstGUI.java +++ b/src/FirstGUI.java @@ -63,6 +63,6 @@ // jf.setSize(300,200); jf.pack(); jf.setVisible(true); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + jf.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); } } diff --git a/src/SecondGUI.java b/src/SecondGUI.java new file mode 100644 index 0000000..f6defc7 --- /dev/null +++ b/src/SecondGUI.java @@ -0,0 +1,23 @@ +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JFrame; + +public class SecondGUI extends JFrame { + public static void main(String[] args){ + new SecondGUI(); + } + public SecondGUI(){ + super("SecondGUI"); + + JButton jb = new JButton("Button"); + getContentPane().setLayout(new FlowLayout()); + getContentPane().add(jb); + // getContentPane().add(jb, BorderLayout.CENTER); + setSize(300,200); + setVisible(true); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + } + +}