frame.dispose does not work for me any sugestions
I found this post while doing a Yahoo search and tried this with no luck it tells me I cannot set a static reference to a non static method dispose()
maybe Im setting it up the wrong way but in someway I need to have an exit button for a form for a practice test and my teachers says that dispose should work. belows the code for the button. It is a default frame using Eclipse 3.2.2 through its visual editor and 1.6_5Update of java sdk(the newest one at the time)
Code:
private JButton getJButtonexit() {
if (jButtonexit == null) {
jButtonexit = new JButton();
jButtonexit.setBounds(new Rectangle(267, 199, 106, 33));
jButtonexit.setText("Exit Frame");
jButtonexit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
frame.dispose();
}
});
}
return jButtonexit;