Clear components of JFrame and add new components
问题 I have a JFrame , which have some options. When OK button is pressed i want the same JFrame to clear the contents and add new contents. I have tried it but the problem is new JFrame is popped out. What am I doing wrong? import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*;