⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 106854c04299001b17aef781993f096e

📁 《J2ME实用教程》 源文件下载 本书没有仅仅局限于J2ME单机游戏的开发
💻
字号:
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Item;
import javax.microedition.lcdui.ItemStateListener;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class ChoiceGroupDemo extends MIDlet implements ItemStateListener,
		CommandListener {
	private Command exitCommand = new Command("Exit",Command.EXIT,1);
	private Form form;
	private Display display;
	private ChoiceGroup group;
	private TextField text;
	
	public ChoiceGroupDemo() {
		super();
		form = new Form("ChoiceGroupDemo");
		display = Display.getDisplay(this); 
		text = new TextField("what you choice is:","",15,TextField.UNEDITABLE);
		String [] stringArray = {"choice a","choice b","choice c"};
		group = new ChoiceGroup("Pop_Up",ChoiceGroup.POPUP,stringArray,null);
		form.append("hello ! ");
		form.append(group);
		form.append(text);
		form.addCommand(exitCommand);
		form.setCommandListener(this);
		form.setItemStateListener(this);
		display.setCurrent(form);
		// TODO Auto-generated constructor stub
	}
	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		// TODO Auto-generated method stub
	}
	protected void startApp(boolean arg0) throws MIDletStateChangeException {
		// TODO Auto-generated method stub
	}
	public void itemStateChanged(Item arg0) {
		// TODO Auto-generated method stub
		if(arg0 instanceof ChoiceGroup){
			text.setString(group.getString(group.getSelectedIndex()));			
		}
	}
	public void commandAction(Command arg0, Displayable arg1) {
		// TODO Auto-generated method stub
	}
} 

⌨️ 快捷键说明

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