I have a Jframe window inside which there is a button. By clicking the button it opens a new JFrame window. But when I close this window it automatically closes the first Jframe window with the button. How can I prevent the first Jframe window from closing when I close the second?
public static void main (String[] args){
        JFrame frame = new JFrame("Test");
        frame.setVisible(true);
        frame.setSize(500,500);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JButton button = new JButton("Test");
        button.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                new SView().gui();
            }
        });
        JPanel panel = new JPanel();
        GridBagLayout gridbag = new GridBagLayout();
        panel.setLayout(gridbag);
        panel.add(button);
        panel.setBackground(new Color(156, 93, 82));
        frame.add(panel, BorderLayout.CENTER);
 
    