I\'m trying to dispose my JFrame by clicking a button, located on a JPanel that is placed on the JFrame that I want to close.
I tried to make a static method on the
Do something like this:
JButton closeFrameButton = new JButton("Close"); closeFrameButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ((Window) getRootPane().getParent()).dispose(); } });