Очистите компоненты JFrame и добавьте новые компоненты

у меня естьJFrame, которые имеют несколько вариантов. Когда кнопка ОК нажата, я хочу то же самоеJFrame очистить содержимое и добавить новое содержимое. Я пробовал это, но проблема новаяJFrame выскочил. Что я делаю неправильно?

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.*;

public class GuiFrame extends JFrame {

    final JFrame f = new JFrame("Test");

    public void Starter(){
        ImageIcon img = new ImageIcon("C:\\Users\\neal\\Desktop\\no.png");
        f.setIconImage(img.getImage());
        ButtonGroup group = new ButtonGroup();
        final JRadioButton Acess = new JRadioButton("Acess");
        final JRadioButton Chat = new JRadioButton("Chat");
        group.add(Acess);
        group.add(Chat);
        f.setSize(400,100);
        f.setLocationRelativeTo(null);
        JButton OptionOk = new JButton("OK");

Label option = new Label("Choose a Option");

        final Container content = f.getContentPane();
        content.setBackground(Color.white);
        content.setLayout(new FlowLayout());

        content.add(option);
        content.add(Acess);
        content.add(Chat);
        content.add(OptionOk);
          f.setVisible(true);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              OptionOk.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {


                try {
                    new GuiFrame().Initiate();
                } catch (UnknownHostException ex) {
                    Logger.getLogger(GuiFrame.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
              });
    }

    public void Initiate() throws UnknownHostException {

        f.removeAll();
        ButtonGroup group = new ButtonGroup();

        final JRadioButton ButtonServer = new JRadioButton("Server");
        final JRadioButton ButtonClient = new JRadioButton("Client");
        group.add(ButtonServer);
        group.add(ButtonClient);

        f.setSize(400, 100);
        f.setLocationRelativeTo(null);
        InetAddress thisIp = InetAddress.getLocalHost();

        ImageIcon img = new ImageIcon("C:\\Users\\neal\\Desktop\\no.png");
        f.setIconImage(img.getImage());
        Label lip = new Label("Your IP is : " + thisIp.getHostAddress());
        Label setup = new Label("Setup as ");
        JButton ButtonOk = new JButton("OK");

        final Container content = f.getContentPane();
        content.setBackground(Color.white);
        content.setLayout(new FlowLayout());
        content.add(lip);
        content.add(setup);
        content.add(ButtonServer);
        content.add(ButtonClient);
        content.add(ButtonOk);
        f.setVisible(true);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) throws UnknownHostException {

        GuiFrame gf = new GuiFrame();
        gf.Starter();
    }
}

Ответы на вопрос(2)

Ваш ответ на вопрос