这里的this 指的是你的方法或成员或操作火灾的这个类,this在这里的作用是说明,你必须在该类里面来实现ActionListener里面的actionPerformed方法,其实(Object t);这里的参数的意思是,这个t是哪个类的对象,那么那个类就负责来实现接口的方法,不知道你理解了没有。
import .*;
import .event.*;
public class Bnbn //implements ActionListener
{
Frame frmFrame;
Button btnUp, btnDown;
public Bnbn()
{
frmFrame = new Frame("按钮应用");
(new GridLayout(2,1));
ss s=new ss();//产生内部类对象作监视器
//产生按钮一
btnUp = new Button("上");
("btnUp");
(s);
//产生按钮二
btnDown = new Button("下");
("btnDown");
(s);
(btnUp);
(btnDown);
();
(true);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
(0);
}
});
}
class ss implements ActionListener //创建内部类作监视器
{
public void actionPerformed(ActionEvent e)
{
String cmd = ();
if ( ("btnDown") )
{
if (()==)
{
();
}
else
{
();
}
}
else
{
if (()==)
{
();
}
else
{
();
}
}
}
}
public static void main(String[] args)
{
new Bnbn();
}
}