How to close my opened GUI form and open another GUI form with just a button in first GUI form. this is my first GUI form
package com.company;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class FirstPageGui extends JFrame implements ActionListener {
    private Container c;
    private JLabel title;
    private JButton signup;
    private JButton signin;
    public FirstPageGui(){
        c = getContentPane();
        c.setLayout(null);
        setTitle("University Management System");
        setBounds(300,90,700,600);
        setResizable(false);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        title = new JLabel("Welcome to University Management System");
        title.setFont(new Font("Arial",Font.PLAIN,25));
        title.setSize(600,30);
        title.setLocation(100,30);
        c.add(title);
        signup = new JButton("Sign up");
        signup.setFont(new Font("Arial",Font.PLAIN,25));
        signup.setSize(200,100);
        signup.setLocation(100,100);
        signup.addActionListener(this);
        c.add(signup);
        signin = new JButton("Sign in");
        signin.setFont(new Font("Arial",Font.PLAIN,25));
        signin.setSize(200,100);
        signin.setLocation(350,100);
        signin.addActionListener(this);
        c.add(signin);
        setVisible(true);
    }
    public void actionPerformed (ActionEvent e){
        if(e.getSource()== signup){
            FirstGUI frstgui = new FirstGUI();
        }
        else if(e.getSource() == signin){
            LoginGUI lgngui = new LoginGUI();
        }
    }
}
I need to press Sign up button and close this GUI form and open new Sign up GUI form with just a code. can you solve this problem?
 
    