java Me中的按键和触屏接口的处理示例(2)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-01 14:15 点击:次
private boolean key_event=true;
private boolean pointer_event=true;
private int startx=0;
private int starty=0;//开始坐标位置
private int currentx = 0;//当前指针坐标位置
private int currenty = 0;
private KeyCanvas keycanvas=null;
private Command exit=null;
public keyPanel(KeyCanvas key)
{
keycanvas=key;
exit=new Command("exit",Command.EXIT,1);
this.addCommand(exit);
this.setCommandListener(this);
}
protected void paint(Graphics g)
{
g.setColor(0);
g.fillRect(0,0,this.getWidth(),this.getHeight());
g.setColor(255);
if(key_event)
g.drawString(key, this.getWidth()/2,this.getHeight()/2,Graphics.TOP|Graphics.HCENTER);
if(pointer_event)
相关新闻>>
- 发表评论
-
- 最新评论 更多>>