import javax.swing.JFrame; import java.awt.Graphics; import java.awt.FlowLayout; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JButton; import javax.swing.JOptionPane; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.util.ArrayList; public class LoginScreen extends JPanel implements ActionListener{ private JTextField login, password; private JButton button; private JLabel loginLabel, passwordLabel; private ArrayList list = new ArrayList(); // stores the proper login names public LoginScreen() { setLayout (new FlowLayout()); login = new JTextField (20); password = new JTextField (20); button = new JButton ("Click"); loginLabel = new JLabel ("Login"); passwordLabel = new JLabel ("Password"); add(loginLabel); add(login); add(passwordLabel); add(password); add (button); button.addActionListener(this); } // In the method below, you will write all the checks for login and password and also display messages as described in the problem public void actionPerformed(ActionEvent a) { String text1 = login.getText(); String text2 = password.getText(); } // In the method below, you will check if input contains atleast one character in A-Z and 0-9 // public boolean check(String input){ // } public static void main (String args []) { LoginScreen ss = new LoginScreen(); JFrame f = new JFrame ("GUI"); f.add(ss); f.setSize(700, 250); f.setVisible (true); f.setResizable(false); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }