I am a beginner programmer, i get issue in adding label while pressing button as the code given when i press the button b1 it should print label 1 or label 2 but it prints nothing, am unable to understand why it happens
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class passField extends JFrame implements ActionListener
{
private JPasswordField pass;
private JButton b1;
private JLabel l,l0;
private JLabel l1;
private JLabel l2;
String password;
Container c;
passField()
{
password="pass3word";
c=super.getContentPane();
pass=new JPasswordField(20);
b1=new JButton("OK");
l=new JLabel("Enter Password: ");
l1=new JLabel("PASSWORD MATCH");
l2=new JLabel("INCORRECT PASSWORD");
Font f=new Font("SERIF",Font.PLAIN,22);
l0=new JLabel("PASSWORD CHECKER");
l1.setFont(f);
l2 .setFont(f);
l0.setFont(f);
l0.setForeground(Color.WHITE);
l.setForeground(Color.WHITE);
l1.setForeground(Color.WHITE);
l2.setForeground(Color.WHITE);
add(l0);
add(l);
add(pass);
add(b1);
b1.addActionListener(this);
setVisible(true);
setSize(400,400);
setLayout(new FlowLayout());
c.setBackground(Color.BLACK);
}
public void actionPerformed(ActionEvent e)
{
if(password==pass.getText())
add(l1);
else
add(l2);
}
}