I keep getting an error when I implement the ActionListener. I dont really understand how to fix it. I did the actionPerformed (ActionEvent ev) {} and put my login button to call it with lg.addActionListener(this);
import java.awt.*;
import javax.swing.*;
import java.awt.Event.*;
import java.applet.Applet;
public class LoginScreen extends JApplet implements ActionListener {
JTextField un;
JPasswordField pw;
JButton lg;
JLabel user,pass;
public LoginScreen () {
un = new JTextField ();
pw = new JPasswordField ();
lg = new JButton ("login");
user = new JLabel ("username");
pass = new JLabel ("password");
lg.addActionListener(this);
this.setLayout(null);
user.setBounds(10, 10, 120, 20);
pass.setBounds(10, 30, 120, 20);
un.setBounds(140, 10, 200, 20);
pw.setBounds(140, 30, 200, 20);
lg.setBounds(140, 55, 100, 20);
this.add(user);
this.add(pass);
this.add(un);
this.add(pw);
this.add(lg);
this.setSize(500, 300);
this.setVisible(true);
}
public void actionPerformed(ActionEvent ev) {
}
}