📄 mycanvas.java
字号:
/*
* MyCanvas.java
*
* Created on 2007年3月28日, 下午3:34
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.tan.ui.shap;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
/**
*
* @author USER
*/
public class MyCanvas extends Canvas implements CommandListener{
private Command exit;
private RectangleExample rectangleExample;
/** Creates a new instance of MyCanvas */
public MyCanvas(RectangleExample rectangleExample) {
this.rectangleExample = rectangleExample;
exit = new Command("Exit",Command.EXIT,1);
addCommand(exit);
setCommandListener(this);
}
protected void paint(Graphics graphics) {
graphics.setColor(255,255,255);
graphics.fillRect(0,0,getWidth(),getHeight());
graphics.setColor(255,0,0);
graphics.drawRect(2,2,20,20);
graphics.drawRoundRect(20,20,60,60,15,45);
}
public void commandAction(Command command, Displayable displayable) {
if(command == exit)
rectangleExample.exitMIDlet();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -