分类:
2008-09-10 09:59:14
/×
几何形状图片绘制
×/
import javax.microedition.midlet.×;
import javax.microedition.lcdui.×;
public class canvasDemo4 extends MIDlet implements CommandListener
{
Display display;
//声明List清单
List list;
//声明查询选择清单指针变量
int viewType;
Command okCommand;
Command exitCommand;
canvasDraw canvasdraw;
public canvasDemo4()
{
canvasdraw=new canvasDraw();
display=Display.getDisplay(this);
list=new List("线条几何形状绘制清单", List.IMPLICIT);
okCommand = new Command("确认", Command.OK, 2);
exitCommand = new Command("离开", Command.EXIT, 2);
list.append("绘制线条", null);
list.append("绘制矩形", null);
list.append("绘制圆角矩形", null);
list.append("绘制弧形", null);
list.append("绘制三角形", null);
list.addCommand(okCommand);
list.addCommand(exitCommand);
list.setCommandListener(this);
}
public void startApp()
{
display.setCurrent(list);
}
public void pauseApp(){}
public void destroyApp(boolean unconditional){}
public void commandAction(Command cmd, Displayable disp)
{
//取得清单选取的list项目
viewType=list.getSelectedIndex();
if (cmd == okCommand)
{
display.setCurrent(canvasdraw);
}
else if(cmd == exitCommand){
destroyApp(false);
notifyDestroyed();
}
}
class canvasDraw extends Canvas implements CommandListener
{
int gameaction=0;
Image handImage;
int changeSD=1;
[1]