We ca use dispose() method.
Sample code provided.please see it.i think it will
solve ur probs.
thanks,
Santhu.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Exp extends JFrame
{
private JButton click;
public Exp()
{
this.getContentPane().setLayout(new FlowLayout());
click = new JButton("ClickMe");
click.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
showAnotherFrame();
}
});
this.getContentPane().add(click);
this.setTitle("baseframe");
this.setSize(250,150);
this.setVisible(true);
this.setLocation(100,150);
}
private void showAnotherFrame()
{
JFrame jframe = new JFrame();
jframe.setTitle("newframe");
jframe.setSize(250,150);
jframe.setVisible(true);
jframe.setLocation(200,150);
this.dispose();
}
public static void main(String args[])
{
new Exp();
}
}