import java.awt.event.*;
import java.awt.*;
public class ww
{
public static void main(String[] args)
{
Button b = new Button("Press Me!");
b.addActionListener(new ButtonHandler());
Frame f = new Frame("MyFrame");
f.add(b);
f.setVisible(true);
}
}
class ButtonHandler implements ActionListener
{
public void ActionPerFormed(ActionEvent e)
{
System.out.println("Action occurred");
}
}
运行后按下按纽b,控制台出现如下东西,它不是应该要输出Action occurred吗??我这个程序是什么程序??是控制台应用程序吗?
java.lang.Error: Unresolved compilation problem:
The type ButtonHandler must implement the inherited abstract method ActionListener.actionPerformed(ActionEvent)
at ButtonHandler.actionPerformed(ww.java:16)
at java.awt.Button.processActionEvent(Button.java:382)
at java.awt.Button.processEvent(Button.java:350)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
import java.awt.*;
public class ww
{
public static void main(String[] args)
{
Button b = new Button("Press Me!");
b.addActionListener(new ButtonHandler());
Frame f = new Frame("MyFrame");
f.add(b);
f.setVisible(true);
}
}
class ButtonHandler implements ActionListener
{
public void ActionPerFormed(ActionEvent e)
{
System.out.println("Action occurred");
}
}
运行后按下按纽b,控制台出现如下东西,它不是应该要输出Action occurred吗??我这个程序是什么程序??是控制台应用程序吗?
java.lang.Error: Unresolved compilation problem:
The type ButtonHandler must implement the inherited abstract method ActionListener.actionPerformed(ActionEvent)
at ButtonHandler.actionPerformed(ww.java:16)
at java.awt.Button.processActionEvent(Button.java:382)
at java.awt.Button.processEvent(Button.java:350)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)