mausam
Posts: 243
Nickname: mausam
Registered: Sep, 2003
|
|
Re: Swing
|
Posted: Jan 8, 2004 6:23 AM
|
|
How abt doing this??
Make the instance of ur frame a class level variable in the class which have ur button.
Now in the action performed event of the button check if the frame is avaliable/visible/ if yes dispose and create another instance of the frame and show. the class might look like
class Sample{
Frame classFrame = null;
Sample() { //ok button and all stuff }
public void okButtonActionPerformed() { if (classFrame == null) { classFrame = new Frame() ; //and all such stuff } else { if (classFrame.isVisible()) //and other check { classFrame.dispose();//and all such stuff } } } }
HTH
|
|