?? ziptest.java
字號(hào):
/*
* 創(chuàng)建日期 2007-7-18
*
* TODO 要更改此生成的文件的模板,請(qǐng)轉(zhuǎn)至
* 窗口 - 首選項(xiàng) - Java - 代碼樣式 - 代碼模板
*/
import com.nttdocomo.ui.*;
import com.nttdocomo.util.JarInflater;
import javax.microedition.io.Connector;
import java.io.InputStream;
public class ZipTest extends IApplication
{
public void start()
{
Image img=null;
String str="";
try
{
JarInflater ji;
ji = new JarInflater(
Connector.openInputStream("resource:///sample.zip"));//打開壓縮文件
MediaImage mi;
mi = MediaManager.getImage(ji.getInputStream("img.gif"));//加載圖片
mi.use();
img = mi.getImage();
InputStream is=ji.getInputStream("text.txt");//打開文本,加載文字
byte [] buf=new byte[1024];
is.read(buf);
str=new String(buf);
ji.close();
}
catch(Exception e){
System.out.println("error" + e);
}
Panel p = new Panel();
if(img!=null) p.add(new ImageLabel(img));//畫圖片
p.add(new Label(str));//畫文字
Display.setCurrent(p);
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -