Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a new frame whilst closing the frame used to open it.

Status
Not open for further replies.

andypara

Programmer
Apr 25, 2002
32
0
0
GB
I'm using the following inner class to make button open a new frame. When the new frame opens, the original one still remains but I want it to dissapear.

How do I do this please?

-----------------------------------------

ButtonHandler handler = new ButtonHandler();
myButton.addActionListener(handler);

class ButtonHandler implements ActionListener

{
public void actionPerformed(ActionEvent event)
{
Andy newAndy = new Andy();

JFrame newFrame = new JFrame("Andy");

newFrame.setContentPane(newAndy.mainPanel);
newFrame.pack();
newFrame.setVisible(true);
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top