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

📄 listcommandscreen.java

📁 一个基于J2ME技术的程序,使你可以远程控制装有服务端的PC.
💻 JAVA
字号:
/* * JRemCntl - Copyright (C) 2007 Filippo Di Vattimo <fildiv@gmail.com> * See COPYING */package fildiv.jremcntl.client.ui;import java.util.Vector;import javax.microedition.lcdui.Choice;import javax.microedition.lcdui.Command;import javax.microedition.lcdui.CommandListener;import javax.microedition.lcdui.Displayable;import javax.microedition.lcdui.List;import javax.microedition.lcdui.Ticker;import fildiv.jremcntl.client.core.AppContext;import fildiv.jremcntl.common.core.Context;public class ListCommandScreen extends CommandScreen 	implements CommandListener {	private Vector cmdsVector = null;	private List cmdsList = null;	private String tickerMessage = "";		public ListCommandScreen(AppContext appCtx) {		super(appCtx);	}	public void reset(boolean clearAll) {				if (clearAll)			clearAll();	}		private void clearAll() {				synchronized(tickerMessage) {			tickerMessage = "";		}	}	private void initList() {		if (cmdsList != null)			return;				Context ctx = getContext();		if (ctx == null)			return;				Vector commands = ctx.getCommands();				cmdsVector = new Vector(commands.size());		String descs[] = new String[commands.size()];				for (int index = 0; index < commands.size(); ++index) {						fildiv.jremcntl.common.core.Command cmd = 				(fildiv.jremcntl.common.core.Command) 					commands.elementAt(index);						cmdsVector.addElement(cmd);			descs[index] = buildCmdLabel(cmd);		}						cmdsList = new List(ctx.getDesc(), 				Choice.IMPLICIT, descs, null);						cmdsList.addCommand(CMD_BACK);				cmdsList.setCommandListener(this);				addCommands(cmdsList);	}		private synchronized void execCommand() {				int index = cmdsList.getSelectedIndex();		fildiv.jremcntl.common.core.Command cmd = 			(fildiv.jremcntl.common.core.Command)				cmdsVector.elementAt(index);		cmdsList.setSelectedIndex(index, true);			if (cmd != null)			execCommand(cmd);	}		protected void onDeactivate() {		super.onDeactivate();		reset(false);	}		public void commandAction(Command c, Displayable d) {				if (manageCommand(c, d))			return;				if (d == cmdsList) {						if (c == List.SELECT_COMMAND) 				execCommand();		}	}		public void setContext(Context ctx) {				super.setContext(ctx);		cmdsList = null;		clearAll();	}	protected void onActivate() {				initList();		getDisplay().setCurrent(cmdsList);		cmdsList.setTicker(new Ticker(tickerMessage));	}		public synchronized void setTickerMessage(String tickerMessage) {						this.tickerMessage = tickerMessage;				if (cmdsList == null)			return;				cmdsList.setTicker(new Ticker(tickerMessage));	}}

⌨️ 快捷键说明

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