midlet6.java

来自「这是郭克华老师的J2ME视频的源代码」· Java 代码 · 共 46 行

JAVA
46
字号
package prj5_1;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Item;
import javax.microedition.lcdui.StringItem;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class MIDlet6 extends MIDlet {
	private Form mainForm = new Form("这是一个含有StringItem的Form");
	private Display dis;

	private StringItem si1 = new StringItem("StringItem1标题","StringItem1内容");
	private StringItem si2 = new StringItem("StringItem2标题","StringItem2内容",Item.PLAIN);
	private StringItem si3 = new StringItem("StringItem3标题","StringItem3内容",Item.BUTTON);
	private StringItem si4 = new StringItem("StringItem4标题","StringItem4内容",Item.HYPERLINK);
	
	protected void startApp() throws MIDletStateChangeException {
		dis = Display.getDisplay(this);
		dis.setCurrent(mainForm);		
		
		mainForm.append(si1);
		mainForm.append(si2);
		mainForm.append(si3);
		mainForm.append(si4);
		
		si3.addCommand(new Command("",Command.ITEM,1));
		
	}
	
	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		

	}

	protected void pauseApp() {
		

	}



}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?