ActionEvent not compiling when used in ActionPerformed

I get the following error

"loginGUI.java": cannot resolve symbol: class ActionEvent in class asys.loginGUI.ButtonListener at line 106, column 34

In Jbuilder10 from the following code

Please advise me where i am going wrong. Thanks in advance.

My "main" is in a separate class called AsysMain
Exert is listed below this class

package asys;

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








public class loginGUI extends JFrame {

  void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, int wy)
{
 gbc.gridx = gx;
 gbc.gridy = gy;
 gbc.gridwidth = gw;
 gbc.gridheight = gh;
 gbc.weightx = wx;
 gbc.weighty = wy;
}

  JPanel loginPane = new JPanel();
  JLabel usernameLabel = new JLabel("Username: ");
  JTextField username = new JTextField();
  JLabel passwordLabel = new JLabel("Password: ");
  JPasswordField password = new JPasswordField();
  JButton submit = new JButton("Submit");
  JButton clear = new JButton("Clear");

  public loginGUI() {
    super("Asys Log in");

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //loginPane.setLocation(128,128);
    loginPane.setSize(500,500);
    GridBagLayout gridbag1 = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    setContentPane(loginPane);

    //usernameLabel
    buildConstraints(constraints,0,0,1,1,100,100);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.EAST;
    gridbag1.setConstraints(usernameLabel,constraints);
    loginPane.add(usernameLabel);

    //username textbox
    buildConstraints(constraints,1,0,2,1,100,100);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.WEST;
    gridbag1.setConstraints(username,constraints);
    loginPane.add(username);

    //passwordLabel
    buildConstraints(constraints,0,1,1,1,100,100);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.EAST;
    gridbag1.setConstraints(passwordLabel,constraints);
    loginPane.add(passwordLabel);

    //password textbox
    buildConstraints(constraints,1,1,2,1,10,100);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.WEST;
    gridbag1.setConstraints(password,constraints);
    loginPane.add(password);

    //submit button
    buildConstraints(constraints,1,2,1,1,100,100);
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.CENTER;
    gridbag1.setConstraints(submit,constraints);
    loginPane.add(submit);
    submit.addActionListener(new ButtonListener());


    //clear button
    buildConstraints(constraints,2,2,1,1,100,100);
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.CENTER;
    gridbag1.setConstraints(clear,constraints);
    loginPane.add(clear);
    clear.addActionListener(new ButtonListener());


    loginPane.setLayout(gridbag1);




  }//koginGUI

  class ButtonListener implements ActionListener
  {
     public void actionPerformed(ActionEvent event)
     {
       Object target = event.getSource();
       
       if (target == submit)
       {
         System.out.println("Submit button pressed");
       }//if
     }//actionPerformed
  }
 


}

   GUI mainFrame = new GUI();
      loginGUI loginFrame = new loginGUI();

      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

      int width = screenSize.width / 2;
      int height = screenSize.height / 2;

      loginFrame.setLocation(width,height);
      loginFrame.setSize(300,200);
      loginFrame.setVisible(true);

      mainFrame.setSize(mainFrame.getToolkit().getScreenSize());
      mainFrame.setVisible(true);
LVL 1
brjattwoodAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zzynxSoftware engineerCommented:
include

        import java.awt.event.*;
0
zzynxSoftware engineerCommented:
in fact better replace

     import java.awt.event.ActionListener;

by

     import java.awt.event.*;
0
zzynxSoftware engineerCommented:
Explanation:
- the class ActionEvent is defined in the package java.awt.event
- By writing
        import java.awt.event.ActionListener;
  you only import the class ActionListener

- if you write

       import java.awt.event.*;

  you import all classes of the package java.awt.event (all the classes you use in your code)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zzynxSoftware engineerCommented:
Thanks for accepting

But I think my answer deserved an A grade instead of a B.
Did you know giving an A grade doesn't cost you any more points while
we get the number of points multiplied by 2 for a C, 3 for a B and 4 for an A?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.