import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


 class Gui  {
	public static void main(String[] args)  {    

Scherm scherm = new Scherm();    

    }
}

class Scherm  extends JFrame implements ActionListener  {

private JFrame f1;
private JPanel p1, p2,p3;
private JButton btnNaarP2,btnNaarP1,btnNaarP3;
private JPasswordField passwordField;
private JTextField loginNaam;
private JLabel label1;

Scherm() {

Login();


//Frame wordt gemaakt
f1 = new JFrame("GUI");
f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f1.setSize(1900,1000);
f1.setVisible(true);


////////////////////////////1ste paneel

p1= new JPanel();
p1.setBackground(Color.CYAN);
f1.add(p1);


//button gemaakt met een coordinaat,grootte,style.
btnNaarP2 = new JButton("Verder");
btnNaarP2.setBounds(800,350,140, 40);   
btnNaarP2.setFont(new Font("Calibri",Font.PLAIN,30));
btnNaarP2.addActionListener(this);
btnNaarP2.setActionCommand("cmd");

//label gemaakt met een coordinaat,grootte,style.
label1=new JLabel();     
label1.setText("Welkom bij de bank");
label1.setBounds(700, 300, 500, 50);
label1.setFont(new Font("Serif",Font.ITALIC,40));




//////////////////////////////2e paneel
p2 = new JPanel();
p2.setBackground(Color.CYAN);
f1.add(p2);


//button gemaakt met een coordinaat,grootte,style.
btnNaarP1= new JButton("Terug");   
btnNaarP1.setBounds(100,900,140,40);   
btnNaarP1.setFont(new Font("Calibri",Font.PLAIN,30));
btnNaarP1.addActionListener(this);
btnNaarP1.setActionCommand("cmd1");

//button gemaakt met een coordinaat,grootte,style.
btnNaarP3= new JButton("Volgende");   
btnNaarP3.setBounds(800,900,180,40);   
btnNaarP3.setFont(new Font("Calibri",Font.PLAIN,30));
btnNaarP3.addActionListener(this);
btnNaarP3.setActionCommand("cmd2");

JLabel label2=new JLabel();     
label2.setText("Scan uw pas");
label2.setBounds(700, 300, 500, 50);
label2.setFont(new Font("Serif",Font.ITALIC,40));




//////Paneel 3

p3 = new JPanel();
p3.setBackground(Color.RED);
//p3.setVisible(true);
//f1.add(p3);               //ERROR





//alles wordt hier bij de panelen toegevoegd.
p1.setLayout(null);
p2.setLayout(null);
p3.setLayout(null);
p1.add(label1);
p1.add(btnNaarP2);
p2.add(btnNaarP1);
p2.add(btnNaarP3);
p2.add(label2);
p3.add(passwordField); 
p3.add(loginNaam);

}

public void Login(){
passwordField = new JPasswordField(20);
passwordField.setBounds(800,350,140, 40);
loginNaam = new JTextField(20); 
loginNaam.setBounds(800,300,140, 40);

}





@Override
    public void actionPerformed(ActionEvent ae) {
        String action = ae.getActionCommand();


        if (action.equals("cmd" )) {  

p1.setVisible(false);
p3.setVisible(false);
f1.validate();
f1.repaint();
f1.invalidate();
p2.setVisible(true);
        }


  if (action.equals("cmd1" )) {  

p2.setVisible(false);
p3.setVisible(false);
f1.validate();
f1.repaint();
f1.invalidate();
p1.setVisible(true);
        }

  if (action.equals("cmd2" )) {  

p1.setVisible(false);
p2.setVisible(false);
f1.validate();
f1.repaint();
f1.invalidate();
f1.getContentPane().add(p3);
p3.setVisible(true);

        }







    }



}


