so i'm trying to create a JButton that closes the JFrame that it is in. here is the button code
JButton buttonClose = new JButton("Close");
buttonClose.setVisible(true);
panelHelp.add(buttonClose);
buttonClose.dispose();
Im getting this error:
the method dispose(); cannot be defined. I'm assuming I need to put an arg in but don't know what needs to go there. I'm new to Java so please go easy on me.
I tried to add an actionlistener as well and that didn't work either.