Can you check for logical issue and re-write 

package GUI.Login;

import Entity.*;
import EntityList.*;
import GUI.*;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class TeacherLoginFrame extends JFrame implements ActionListener {
    private JTextField textField;
    private JPasswordField passwordField;
    private JButton loginButton;
    private JButton showPasswordButton;

    public TeacherLoginFrame() {
        setTitle("Teacher Login");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(1100, 800);
        setLocationRelativeTo(null);

        // Load the background image
        ImageIcon backgroundIcon = new ImageIcon("GUI/Pictures/TeacherLogin/right_background.png");
        Image backgroundImage = backgroundIcon.getImage().getScaledInstance(getWidth(), getHeight(),
                Image.SCALE_SMOOTH);
        backgroundIcon = new ImageIcon(backgroundImage);

        // Create a label with the background image as icon
        JLabel backgroundLabel = new JLabel(backgroundIcon);
        backgroundLabel.setLayout(new GridBagLayout());
        add(backgroundLabel);

        // Create a new JButton with the eye icon
        ImageIcon eyeIcon = new ImageIcon("GUI/Pictures/TeacherLogin/eye.png");
        showPasswordButton = new JButton(eyeIcon);
        showPasswordButton.addActionListener(this);
        showPasswordButton.setPreferredSize(new Dimension(25, 25));

        JLabel userLabel = new JLabel("Username:");
        textField = new JTextField();
        J