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

📄 commandscreen.java

📁 一个基于J2ME技术的程序,使你可以远程控制装有服务端的PC.
💻 JAVA
字号:
/* * JRemCntl - Copyright (C) 2007 Filippo Di Vattimo <fildiv@gmail.com> * See COPYING */package fildiv.jremcntl.client.ui;import javax.microedition.lcdui.Command;import javax.microedition.lcdui.CommandListener;import javax.microedition.lcdui.Displayable;import fildiv.jremcntl.client.core.AppContext;import fildiv.jremcntl.client.core.JRemClientProtocol;import fildiv.jremcntl.client.core.QuestionListener;import fildiv.jremcntl.common.core.Context;import fildiv.jremcntl.common.util.JRemUtils;public class CommandScreen extends AbstractScreen implements CommandListener {		protected final static Command CMD_BACK =		new Command("Back", Command.BACK, 1);	protected final static Command CMD_SWITCH =		new Command("Switch view", Command.SCREEN, 1);	protected final static Command CMD_LOGS =		new Command("Logs", Command.SCREEN, 2);	private Context ctx = null;	private QuestionScreen questionScreen;		public CommandScreen(AppContext appCtx) {		super(appCtx);		questionScreen = new QuestionScreen(appCtx, this);	}	private JRemClientProtocol proto;		protected synchronized void execCommand(			final fildiv.jremcntl.common.core.Command cmd) {										String question = cmd.getQuestion();		if (question != null && question.length() > 0) {					questionScreen.setQuestion(question);			questionScreen.show(new QuestionListener() {					public void reponse(short response) {					if (response == QuestionScreen.QS_YES) {						sendCommand(cmd);					}				}			});					} else {			sendCommand(cmd);		}	}			protected void sendCommand(final fildiv.jremcntl.common.core.Command cmd) {		try {			proto.sendCommandID(cmd.getID());		} catch(Exception e) {			logln("Error occurred while execCommand : " + e.getMessage());					} finally {		}			}		protected String buildCmdLabel(fildiv.jremcntl.common.core.Command cmd) {				String label = "";				if (cmd.getKey().length() > 0)			label = "(" + cmd.getKey() + ") ";				label+= cmd.getDesc();				return label;	}			public void setProtocol(JRemClientProtocol proto) {		this.proto = proto;		}			public Context getContext() {		return ctx;	}		public void setContext(Context ctx) {		this.ctx = ctx;	}	protected boolean manageCommand(Command c, Displayable d) {		boolean managed = false;		CommandPanelScreen cps = (CommandPanelScreen) getBackScreen();				if (c == CMD_BACK) {			hide(false);			cps.hide();						managed = true;		} else if (c == CMD_SWITCH) {			hide(false);				cps.swithView();						managed = true;		} else if (c == CMD_LOGS) {			showLogs();			managed = true;		}				return managed;	}		protected void addCommands(Displayable d) {		d.addCommand(CMD_BACK);				if (JRemUtils.hasKeysAssigned(ctx))			d.addCommand(CMD_SWITCH);						d.addCommand(CMD_LOGS);				d.setCommandListener(this);			}		public void commandAction(Command c, Displayable d) {		manageCommand(c, d);	}}

⌨️ 快捷键说明

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