【Java开源代码栏目提醒】:本文主要为网学会员提供Color_Transparent_MIDlet.java,希望对需要Color_Transparent_MIDlet.java网友有所帮助,学习一下!
package ch06;
import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class Color_Transparent_MIDlet
extends MIDlet
implements CommandListener {
//声明一个实现绘制的Canvas类对象
private Color_Transparent_Canvas ctc;
/*
1.启动应用程序
*/
public void startApp() {
if (ctc == null) {
try {
ctc = new Color_Transparent_Canvas();
Display.getDisplay(this).setCurrent(ctc);
Command exitCommand = new Command("退出", Command.EXIT, 0);
ctc.addCommand(exitCommand);
ctc.setCommandListener(this);
//启动绘制图形
ctc.start();
}
catch (IOException ioe) {
System.out.println(ioe.getMessage());
}
}
}
//挂起应用
程序 public void pauseApp() {
}
//撤消应用程序
public void destroyApp(boolean unconditional) {
}
/*
2.响应按钮事件
*/
public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT) {
destroyApp(true);
notifyDestroyed();
}
}
}