Well, Ihave made some changes to my program but I STILL HAVE ONE ERROR LEFT AND I DON'T KNOW WHAT I SHOULD DO TO IT.PLEASE HELP ME.HERE IS MY MODIFIED PROGRAM WITH ONE ERROR:
[
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class moimoi extends JFrame
{
private JLabel secondsL, YearsL, WeeksL, DaysL, HoursL, MinuteL, SecondsL;
private JButton calculateB, exitB;
private JTextField secondsTF, YearsTF, WeeksTF, DaysTF, HoursTF, MinuteTF, SecondsTF;
private CalculateButtonHandler cbHandler;
private ExitButtonHandler ebHandler;
private static final int WIDTH = 326;
private static final int HEIGHT = 450;
public moimoi()
{
secondsL = new JLabel("Enter Seconds: ", SwingConstants.RIGHT);
YearsL = new JLabel("Years: ", SwingConstants.RIGHT);
WeeksL = new JLabel("Weeks: ", SwingConstants.RIGHT);
DaysL = new JLabel("Days: ", SwingConstants.RIGHT);
HoursL = new JLabel("Days: ", SwingConstants.RIGHT);
MinuteL = new JLabel("Minute: ", SwingConstants.RIGHT);
SecondsL = new JLabel("Seconds: ", SwingConstants.RIGHT);
secondsTF = new JTextField(13);
YearsTF = new JTextField(13);
WeeksTF = new JTextField(13);
DaysTF = new JTextField(13);
HoursTF = new JTextField(13);
MinuteTF = new JTextField(13);
SecondsTF = new JTextField(13);
calculateB = new JButton("Calculate");
cbHandler = new CalculateButtonHandler();
calculateB.addActionListener(cbHandler);
exitB = new JButton("Exit");
ebHandler = new ExitButtonHandler();
exitB.addActionListener(cbHandler);
setTitle("Seconds Converter Program ");
Container pane = getContentPane();
pane.setLayout(new GridLayout (7, 2));
pane.add(secondsL);
pane.add(secondsTF);
pane.add(YearsL);
pane.add(YearsTF);
pane.add(WeeksL);
pane.add(WeeksTF);
pane.add(DaysL);
pane.add(DaysTF);
pane.add(HoursL);
pane.add(HoursTF);
pane.add(MinuteL);
pane.add(MinuteTF);
pane.add(SecondsL);
pane.add(SecondsTF);
pane.add(calculateB);
pane.add(exitB);
setSize(WIDTH, HEIGHT);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
private class CalculateButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
double seconds, years, weeks, days, hours, minute, Seconds;
seconds = Double.parseDouble(secondsTF.getText());
years = 365* days * 86400 * seconds ;
weeks = 7 * days * 86400 * seconds ;
days = 24 * hours * 3600 * seconds;
hours = 60 * minute * 60 * seconds;
minute = 1 * seconds * 60 * seconds;
Seconds = seconds;
secondsTF.setText("" + String.format("%.2f%n", seconds));
YearsTF.setText("" + String.format("%.2f%n", years));
WeeksTF.setText("" + String.format("%.2f%n", weeks));
DaysTF.setText("" + String.format("%.2f%n", days));
HoursTF.setText("" + String.format("%.2f%n", hours));
MinuteTF.setText("" + String.format("%.2f%n", minute));
SecondsTF.setText("" + String.format("%.2f%n", Seconds));
}
}
private class ExitButtonHandler implements ActionListener
{
public void actionPerfomed(ActionEvent e)
{
System.exit(0);
}
}
public static void main(String[] args)
{
moimoi moiObject = new moimoi();
}
}
/]
AND HERE IS THE ERROR;
H:\JAVAFILES>javac moimoi.java
moimoi.java:107: moimoi.ExitButtonHandler is not abstract and does not override
abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.Ac
tionListener
private class ExitButtonHandler implements ActionListener
^
1 error