hi, My code is runnig perfect but I am missing a detail, and I have no idea how to. The situation is when you input the password does not matter if it is upper o lowercase it will say "access granted" otherwise will say "access deined"
Thanks
Code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JPasswordB extends JApplet implements ActionListener
{
Container con = getContentPane ();
JLabel please = new JLabel ("Please Enter Password");
Font headlineFont = new Font("Helvetica", Font.BOLD, 36);
JButton enter = new JButton("Click to Enter");
JLabel passtyped = new JLabel ("");
String password = "Rosebud";
JPasswordField fieldpassword = new JPasswordField(8);
public void init()
{
please.setFont(headlineFont);
con.add(please);
con.add(fieldpassword);
con.add(enter);
con.setLayout(new FlowLayout());
enter.addActionListener(this);
fieldpassword.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
String name = fieldpassword.getText();
if
( name.equals ( password ) )
{
passtyped.setText("Access granted");
con.add(passtyped);
}
else
{
passtyped.setText("Access Denied");
con.add(passtyped);
validate();
}
}
}