ActionListener doesn't compile

trying to write an inner class that will perform an action when clicking a button, but the "implements ActionListener" command isn't compiling. Here's the code:

package com.jasonwardenburg.cashgui;

import javax.swing.*;

import java.awt.*;

publicclass CashFrame{

//instantiate variables here so inner class can see them

JFrame cashEntryFrame;

JButton testButton;

JPanel panel1;

JLabel dateLabel;

JTextField dateField;

JLabel categoryLabel;

JLabel amountLabel;

JTextField categoryField;

JTextField amountField;

// main

publicstaticvoid main (String[] args){

CashFrame gui =new CashFrame();

gui.go();

}// end main

// go method

publicvoid go(){

cashEntryFrame =new JFrame("Cash Entry App");

cashEntryFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

panel1 =new JPanel();

// enter date

dateLabel =new JLabel("enter date here:");

dateField =new JTextField(20);

// enter category

categoryLabel =new JLabel("enter category:");

categoryField =new JTextField(20);

// enter amount

amountLabel =new JLabel("enter amount:");

amountField =new JTextField(20);

testButton =new JButton("save data");

// testButton.addActionListener(ButtonListener());

// add label and field to panel

panel1.add(dateLabel);

panel1.add(dateField);

panel1.add(categoryLabel);

panel1.add(categoryField);

panel1.add(amountLabel);

panel1.add(amountField);

// add stuff to fram and make visible

cashEntryFrame.getContentPane().add(BorderLayout.SOUTH, testButton);

cashEntryFrame.getContentPane().add(BorderLayout.CENTER, panel1);

cashEntryFrame.setSize(400,400);

cashEntryFrame.setVisible(true);

System.out.println(dateField.getText());

}// end go

//inner class for button listener

class ButtonListenerimplements ActionListener{

}// end inner class

}// end class

here's the javac error:

C:\java\cashLog\src>javac -d ../classes com/jasonwardenburg/cashgui/*.java

com/jasonwardenburg/cashgui/CashFrame.java:74: cannot find symbol

symbol : class ActionListener

location: class com.jasonwardenburg.cashgui.CashFrame

class ButtonListener implements ActionListener{

^

1 error

C:\java\cashLog\src>

thanks,

bp

[4097 byte] By [badpersona] at [2007-11-27 6:27:22]
# 1

You have to import one more package java.awt.event.*;

and

class ButtonListener implements ActionListener{

public void actionPerformed(ActionEvent e)

{

// actions

}

}

Reona at 2007-7-12 17:49:13 > top of Java-index,Java Essentials,New To Java...
# 2

thanks,

I had tried that before. I added the actionPerformed method back into it, and added the listener to the button, and it gives me this as a javac error:

C:\java\cashLog\src>javac -d ../classes com/jasonwardenburg/cashgui/*.java

com/jasonwardenburg/cashgui/CashFrame.java:74: cannot find symbol

symbol : class ActionListener

location: class com.jasonwardenburg.cashgui.CashFrame

class ButtonListener implements ActionListener{

^

com/jasonwardenburg/cashgui/CashFrame.java:75: cannot find symbol

symbol : class ActionEvent

location: class com.jasonwardenburg.cashgui.CashFrame.ButtonListener

public void actionPerformed(ActionEvent e){

^

com/jasonwardenburg/cashgui/CashFrame.java:49: cannot find symbol

symbol : method ButtonListener()

location: class com.jasonwardenburg.cashgui.CashFrame

testButton.addActionListener(ButtonListener());

^

3 errors

badpersona at 2007-7-12 17:49:13 > top of Java-index,Java Essentials,New To Java...
# 3
never mind, it worked with the import statement. thanks!!bp
badpersona at 2007-7-12 17:49:13 > top of Java-index,Java Essentials,New To Java...