First off, I'd like to appologize for the original post I made about this... As I realized all too late that it was too long, that being said...
I'm trying to create an application that basically contains two frames ( for purposes of this explanation ). The first frame contains one button with an ActionListener that opens a new window/frame:
public class FirstFrame extends JFrame {
public FirstFrame() {
super( "First" );
setLayout( new FlowLayout() );
JButton btn = new JButton( "remove frame" );
btn.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent ae ) {
closeThisWindow();
}
} );
add( btn, SwingConstants.CENTER );
}
private void closeThisWindow() {
SecondFrame frame = new SecondFrame();
GUIKit a = new GUIKit();
a.iniJFrame( frame );
this.setVisable( false );
}
}// end of class
This works fine except that when the button is pushed both frames are visible, with the first one being completely blank and the second frame under it. To remove that first frame I've tried:
this.setVisable( false );
this.getParent().setVisable( false) ~ this returns a NullPointerException;
this.enable(false) ~ this really doesn't do anything.
and this.hide() which is depreacated... and doesn't work either
It just doesn't want to remove that window/frame... Any ideas? Or, am I just missing something completely?