?? imageitem_test.java
字號:
package src;
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDletStateChangeException;
public class ImageItem_Test extends MIDlet implements CommandListener{
private Display ds;
private Form form;
private ImageItem img;
private Command cmd_exit = new Command("退出",Command.EXIT,1);
private Command cmd_explorer = new Command("Explorer",Command.SCREEN,1);
private int flag = 1;
public ImageItem_Test() {
// TODO 自動生成構造函數存根
}
protected void destroyApp(boolean unconditional) {
// TODO 自動生成方法存根
}
protected void pauseApp() {
// TODO 自動生成方法存根
}
protected void startApp() throws MIDletStateChangeException {
// TODO 自動生成方法存根
ds = Display.getDisplay(this);
form = new Form("Image Explorer");
try {
img = new ImageItem("MYImage",Image.createImage("/res/image4.png"), ImageItem.LAYOUT_LEFT|ImageItem.LAYOUT_NEWLINE_BEFORE, "Image explorer");
} catch (java.io.IOException e) {
// TODO 自動生成 catch 塊
e.printStackTrace();
}
form.append(img);
flag=1;
form.addCommand(cmd_exit);
form.addCommand(cmd_explorer);
form.setCommandListener(this);
ds.setCurrent(form);
}
public void commandAction(Command c, Displayable d) {
// TODO 自動生成方法存根
if(c==cmd_exit)
{
destroyApp(false);
notifyDestroyed();
}
if(c==cmd_explorer)
{
if(flag==1)
{
try
{
img.setImage(Image.createImage("/res/image3.png"));
}
catch(java.io.IOException e)
{}
}
else
{
try
{
img.setImage(Image.createImage("/res/image4.png"));
}
catch(java.io.IOException e){}
}
flag = flag*(-1);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -