Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Closing JFrame with a button inside JPanel???

843804Nov 5 2004 — edited Nov 6 2004
here is what i have:

class MyFrame extends JFrame{
MyFrame(){
MyPanel panel = new MyPanel();
getContentPane().add(panel);
setVisible(true);
etc...
}
}

class MyPanel extends JPanel implements ActionListener{
MyPanel(){
JButton quit = new JButton("quit");
add(quit);
etc...
}

public actionPerformed(ActionEvent e){
//I want to close JFrame is a click a button call exit here
//how do i close JFrame
}
}

please help. thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 4 2004
Added on Nov 5 2004
2 comments
558 views