java Me中的按键和触屏实例(3)
plan_x=this.getWidth()/2;
plane_y=this.getHeight()/2;
exit=new Command("退出",Command.EXIT,1);
start=new Command("启动",Command.SCREEN,1);
over=new Command("结束",Command.SCREEN,2);
point=new Command("指针启动",Command.SCREEN,3);
trante=new Command("启动旋转",Command.SCREEN,4);
this.addCommand(exit);
this.addCommand(start);
this.addCommand(point);
this.addCommand(trante);
this.setCommandListener(this);
}
protected void paint(Graphics g)
{
g.setColor(0,0,0);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
g.drawImage(planeImage,plan_x,plane_y,g.HCENTER|g.VCENTER);
if(trante_event)
{
g.translate(trante_x, trante_y);
g.drawImage(planeImage,0,0,Graphics.LEFT | Graphics.TOP);
}
}
public void commandAction(Command arg0, Displayable arg1)
相关新闻>>
- 发表评论
-
- 最新评论 更多>>