我编译了有两处错误 但是我不知道怎么改哦~这个程序是实现用键盘的上下左右控制button的移动
import java.awt.event.*;import java.applet.*;
import java.awt.*;
public class 1
{ button b_go=new button("go"),
int b_x=0,b_y=0;
public void init()
{ b_go.addkeylistener(this);
}
public void keypressed(keyevent e)
{ if(e.getkeycode()==leyevent.VK_UP)
{ rectangle rect=new rectangle(b_x,b_y,20,20);
b_y=b_y-2;b_go.setlocation(b_x,b_y);
}
if(e.getkeycode()==leyevent.VK_DOWN)
{ rectangle rect=new rectangle(b_x,b_y,20,20);
b_y=b_y+2;b_go.setlocation(b_x,b_y);
}
if(e.getkeycode()==leyevent.VK_RIGHT)
{ rectangle rect=new rectangle(b_x,b_y,20,20);
b_x=b_x+2;b_go.setlocation(b_x,b_y);
}
if(e.getkeycode()==leyevent.VK_LETT)
{ rectangle rect=new rectangle(b_x,b_y,20,20);
b_x=b_x-2;b_go.setlocation(b_x,b_y);
}
}
public void keyreleased(keyevent e){}
public vold keytyped(keyevent e){}
public voide actionperformed(actionevent e)
{ b_go.setbounds(22,45,20,20);
b_x=b_go.getbounds().x;b_y=b_go.getbounds().y;
b_go.requestfocus() ;
}
}