?? imagelist.java
字號:
?
+
package com.j2medev.ch8.mmapi;
import javax.microedition.lcdui.*;
public class ImageList extends List implements CommandListener {
private PowerCamera pc = null;
private Picture[] pic = null;//?
private int currentPos = -1;//
public static final Command backCommand = new Command("返回",Command.BACK,1);
public static final Command nextCommand = new Command("下一個",Command.OK,1);
public static final Command listCommand = new Command("列表",Command.BACK,2);
public ImageList(PowerCamera pc) {
super("圖片列表",List.IMPLICIT);
this.pc = pc;
this.addCommand(backCommand);
this.setCommandListener(this);
}
public void initTitle(Picture[] _pic){
pic = _pic;
this.deleteAll();
for(int i = 0;i<pic.length;i++){
Image image = Image.createImage(pic[i].getImg(), 0, pic[i].getImg().length);
//?????????
this.append(pic[i].getTitle(), ImageUtil.createThumbnail(image, 40));
}
}
public void commandAction(Command cmd,Displayable displayable){
if(cmd == backCommand){
pc.backToMain();
}else if(cmd == List.SELECT_COMMAND){
int i = this.getSelectedIndex();
currentPos = i;
showPicture(i);
}else if(cmd == nextCommand){
//
if(currentPos == this.size()-1){
currentPos = 0;
}else{
currentPos = currentPos + 1;
}
showPicture(currentPos);
}else if(cmd == listCommand){
pc.setCurent(this);
}
}
private void showPicture(int i){
//?
Form form = new Form(pic[i].getTitle());
form.append(Image.createImage(pic[i].getImg(), 0, pic[i].getImg().length));
form.addCommand(nextCommand);
form.addCommand(listCommand);
form.setCommandListener(this);
pc.setCurent(form);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -