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

