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

📄 questionscreen.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 javax.microedition.lcdui.Form;import fildiv.jremcntl.client.core.AppConstants;import fildiv.jremcntl.client.core.AppContext;import fildiv.jremcntl.client.core.QuestionListener;import fildiv.jremcntl.client.util.UIUtils;public class QuestionScreen extends AbstractScreen implements CommandListener {	public static final short QS_NO = 0;	public static final short QS_YES = 1;		private final static Command CMD_YES =		new Command("Yes", Command.OK, 1);	private final static Command CMD_NO =		new Command("No", Command.EXIT, 1);	private Form questionForm;	private short response;	private String question;	private QuestionListener questionListener;	public QuestionScreen(AppContext appCtx, Screen backTo) {		this(appCtx, backTo, "");	}		public QuestionScreen(AppContext appCtx, Screen backTo, 			String question) {		super(appCtx, backTo);			questionForm = new Form(AppConstants.QUESTION_SCREEN_CAPTION);		questionForm.addCommand(CMD_YES);		questionForm.setCommandListener(this);		questionForm.addCommand(CMD_NO);	}		public void setQuestion(String question) {		this.question = question;	}		public String getQuestion() {		return question;	}		protected void onActivate() {		super.onActivate();				questionForm.deleteAll();		UIUtils.appendText(questionForm, question);				getAppCtx().getDisplay().setCurrent(questionForm);	}	public short getResponse() {		return response;	}		public void commandAction(Command c, Displayable arg1) {				if (c == CMD_YES)			response = QS_YES;		else 			response = QS_NO;		questionListener.reponse(response);		hide();	}			public void show() {		throw new IllegalArgumentException(				"Use show(QuestionListener)!");	}		public void show(QuestionListener questionListener) {		if (questionListener == null)			throw new IllegalArgumentException();				this.questionListener = questionListener;		super.show();	}}

⌨️ 快捷键说明

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