Witam,
mam problem z odpowiednim wywołaniem MenuBara mianowicie nie wiem czemu po użyciu metod: removeGui, secondUi; MenuBar znika.
Pierwotnie chciałem createMenuBar wywołać w secondUi ale pojawia się wszystko poza nim.
Jakiś inny sposób na edycje zawartości okienka?

package SOT;

import javax.swing.*;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

import static SOT.User.loginPanel;


public class Gui extends JFrame implements ActionListener {
    static int tempid;
    static String tempSurname, tempPassword;

    JButton exitButton, loginButton;
    JLabel idText, surnameText, passwordText, infoText;
    JTextField idField, surnameField, passwordField;

    JLabel userText;
    JButton sellButton, returnButton, showStuffButton, logoutButton;

    JMenuBar menuBar;
    JMenu menuPlik, menuNarzedzia, menuPomoc;
    JMenuItem mOwtorz, mZapisz, mWyjscie;

    ArrayList guiUserPanel= new ArrayList();
    ArrayList loginUiList = new ArrayList();

    User userLogin = new User();
    User userData = new User();

    Gui() throws IOException {
        setSize(800,400); // size of frame
        setTitle("System obrotu towaru w sklepie komputerowym");
        setLayout(null);
        loginUi();
        createMenuBar();


    }
    //FIRST UI
    private void loginUi(){

        loginButton = new JButton("Zaloguj");
        loginButton.setBounds(300,200,100,40); /// position of loginButton
        add(loginButton);
        loginButton.addActionListener(this); // login button is a source of event, Shop(frame) is listener
        loginUiList.add(loginButton);

       [...]
    }

// SECOND UI
    private void secondUi(){

        createLabel();
        createButtons();
        createMenuBar();
    }
    private void createLabel(){
        userText = new JLabel("Witaj,"+userData.getUserName());
        userText.setBounds(700,5,100,10);
        userText.setForeground(new Color(150,80,80));//set color of firstText
        userText.setFont(new Font("SansSerif", Font.BOLD,10));//set font of firstText
        add(userText);
        guiUserPanel.add(userText);
    }
    private void createButtons(){
        sellButton = new JButton("Sprzedaz");
        sellButton.setBounds(50,50,100,40); /// position of loginButton
        add(sellButton);
        sellButton.addActionListener(this); // login button is a source of event, Shop(frame) is listener
        guiUserPanel.add(sellButton);

      [...]
    }
    private void createMenuBar(){


        menuBar = new JMenuBar();
        menuPlik = new JMenu("Plik");
        menuNarzedzia = new JMenu("Narzedzia");
        menuPomoc = new JMenu("Pomoc");


        menuBar.add(menuPlik);
        setJMenuBar(menuBar);


    }
    public void removeGui(ArrayList list){
        //Object tmp = new Object();
        for(int i =0; i < list.size(); i++){
            remove((Component) list.get(i));
        }
        repaint();
    }


    @Override
    public void actionPerformed(ActionEvent e) {
        Object actionSource = e.getSource();


        if (actionSource == loginButton) {
            try {
                String stringInput = idField.getText();
                tempid = stringInput == null || stringInput.isEmpty() ? 0 : Integer.parseInt(stringInput);
                tempSurname = surnameField.getText();
                tempPassword = passwordField.getText();
                if(loginPanel(userData, userLogin)) {
                    TimeUnit.SECONDS.sleep(0);
                    removeGui(loginUiList);
                    secondUi();
                    

                } else {
                    infoText.setText("Błędne dane");
                }
            }
            catch (IOException e1) {
                e1.printStackTrace(); //JOptionPane
            } catch (InterruptedException e1) {
                e1.printStackTrace();
            } catch (NumberFormatException e1){
                e1.printStackTrace();
                infoText.setText("Błędne ID");
            }

        } else if (actionSource == exitButton) {
            try {
                dispose(); // close the window
            } catch (NumberFormatException e1) {
                e1.printStackTrace();
            }

        }
    }
}