If I want that on clicking a certain button the current frame should close and a new frame with new content should appear, how can I do that? For example, I have a login button, which on clicking leads to a new frame and closing the old frame.
public void actionPerformed(ActionEvent evt) {
setVisible(false);//for closing the old frame
Now how can I add a new frame?