如题,看不懂错误的解释,望高手不厌其烦的能为我解说一下,谢谢!在线等
package A;
import java.awt.*;
import javax.swing.*;
import java.applet.*;
import java.awt.event.*;
class Addbutton extends JPanel
{
JButton bRed;
JButton bGreen;
JButton bBlue;
public Addbutton()
{
JButton bRed=new JButton("红");
JButton bGreen=new JButton("绿");
JButton bBlue=new JButton("蓝");
MyListener1 listener1=new MyListener1();
bRed.addActionListener(listener1);
MyListener2 listener2=new MyListener2();
bGreen.addActionListener(listener2);
MyListener3 listener3=new MyListener3();
bBlue.addActionListener(listener3);
this.setLayout(new FlowLayout());
this.add(bRed);
this.add(bGreen);
this.add(bBlue);
}
private class MyListener1 implements ActionListener
{
public void actionperformed(ActionEvent e)
{
setBackground(Color.red);
//Repain();
}
}
private class MyListener2 implements ActionListener
{
public void actionperformed(ActionEvent e)
{
setBackground(Color.green);
//rePain();
}
}
private class MyListener3 implements ActionListener
{
public void actionperformed(ActionEvent e)
{
setBackground(Color.blue);
//repain();
}
}
}
public class A extends JFrame
{
public A(String tilte)
{
this.setTitle(title);//super(title);
Container contpane=this.getContentPane();
Addbutton adb=new Addbutton();
contpane.add(adb);
this.setSize(300,300);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[]args)
{
A frame=new A("窗体测试");
}
}
--------------------配置: <默认>--------------------
G:\learn space\Java\两个窗体\A.java:27: A.Addbutton.MyListener1 不是抽象的,并且未覆盖 java.awt.event.ActionListener 中的抽象方法 actionPerformed(java.awt.event.ActionEvent)
private class MyListener1 implements ActionListener
^
G:\learn space\Java\两个窗体\A.java:35: A.Addbutton.MyListener2 不是抽象的,并且未覆盖 java.awt.event.ActionListener 中的抽象方法 actionPerformed(java.awt.event.ActionEvent)
private class MyListener2 implements ActionListener
^
G:\learn space\Java\两个窗体\A.java:43: A.Addbutton.MyListener3 不是抽象的,并且未覆盖 java.awt.event.ActionListener 中的抽象方法 actionPerformed(java.awt.event.ActionEvent)
private class MyListener3 implements ActionListener
^
G:\learn space\Java\两个窗体\A.java:56: title 在 java.awt.Frame 中不是公共的;无法从外部软件包中对其进行访问
this.setTitle(title);//super(title);
^
4 错误
处理已完成