本文整理汇总了Java中javax.microedition.lcdui.CommandListener类的典型用法代码示例。如果您正苦于以下问题:Java CommandListener类的具体用法?Java CommandListener怎么用?Java CommandListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandListener类属于javax.microedition.lcdui包,在下文中一共展示了CommandListener类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: editString
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
/**
* @inheritDoc
*/
public void editString(Component cmp, int maxSize, int constraint, String text, int keyCode) {
UIManager m = UIManager.getInstance();
CONFIRM_COMMAND = new Command(m.localize("ok", "OK"), Command.OK, 1);
CANCEL_COMMAND = new Command(m.localize("cancel", "Cancel"), Command.CANCEL, 2);
if(mid.getAppProperty("forceBackCommand") != null) {
canvas.addCommand(MIDP_BACK_COMMAND);
}
currentTextBox = new TextBox("", "", maxSize, TextArea.ANY);
currentTextBox.setCommandListener((CommandListener)canvas);
currentTextBox.addCommand(CONFIRM_COMMAND);
currentTextBox.addCommand(CANCEL_COMMAND);
currentTextComponent = cmp;
currentTextBox.setMaxSize(maxSize);
currentTextBox.setString(text);
currentTextBox.setConstraints(constraint);
display.setCurrent(currentTextBox);
((C)canvas).setDone(false);
Display.getInstance().invokeAndBlock(((C)canvas));
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:23,代码来源:GameCanvasImplementation.java
示例2: MultiSubmitStatusScreen
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
/**
* @param listener
* @param modelIDs
*/
public MultiSubmitStatusScreen(CommandListener listener, TransportResponseProcessor responder, boolean silenceable, String cancelText) {
//#style submitPopup
super(Localization.get("sending.status.title"));
setCommandListener(listener);
this.silenceable = silenceable;
this.cancelText = cancelText;
cancelCmd = new Command(cancelText == null ? Localization.get("menu.ok") : cancelText, Command.OK, 1);
if (silenceable) {
setOKCommand();
}
this.responder = responder;
responses = new Vector<String>();
finalResponse = "";
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:24,代码来源:MultiSubmitStatusScreen.java
示例3: handleInvalidUser
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
/**
*
*
*
* @param status
*/
public void handleInvalidUser(int status, CommandListener listener) {
String s = Localization.get("activity.adduser.problem");
if (status == UserValidator.USER_EXISTS) {
s += ": " + Localization.get("activity.adduser.problem.nametaken", new String[]{this.view.getUsername()});
}
if (status == UserValidator.USERORPASSWD_MISSING) {
s += ": " + Localization.get("activity.adduser.problem.emptyuser");
}
if (status == UserValidator.MISMATCHED_PASSWORDS) {
s += ": " + Localization.get("activity.adduser.problem.mismatchingpasswords");
}
J2MEDisplay.showError(null,s);
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:25,代码来源:UserValidator.java
示例4: showSuspendAlert
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
/**
* Shows alert notifying user of system suspend.
* @param token security token for accessing restricted API
*/
static synchronized void showSuspendAlert(final SecurityToken token) {
if (null == suspendAlert && AlertTimer.shouldShow()) {
String title = Resource.getString(
ResourceConstants.SR_SUSPEND_ALERT_TITLE, null);
String message = Resource.getString(
ResourceConstants.SR_SUSPEND_ALERT_MSG, null);
AlertTimer.start();
CommandListener ignoring = new CommandListener() {
public void commandAction(Command c, Displayable d) {}
};
suspendAlert = new SystemAlert(getDisp(token), title,
message, null, AlertType.WARNING);
suspendAlert.setCommandListener(ignoring);
suspendAlert.runInNewThread();
}
}
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:25,代码来源:SuspendResumeUI.java
示例5: showLoginRequiredMessage
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
/**
* Show a login required message on the screen.
*
* @param title
* @param alertText
* @param type
*/
public final void showLoginRequiredMessage() {
Alert alert = new Alert(LOGIN_REQUIRED_LABEL, LOGIN_REQUIRED_TEXT,
null, AlertType.INFO);
alert.addCommand(new Command(LOGIN_REQUIRED_YES, Command.OK, 0));
alert.addCommand(new Command(LOGIN_REQUIRED_NO, Command.CANCEL, 0));
alert.setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable d) {
if(c.getCommandType() == Command.OK) {
showLoginView();
} else {
setDisplay(self);
}
}
});
setDisplay(alert);
}
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:25,代码来源:BaseFormView.java
示例6: Midlet
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
public Midlet() {
form = new Form("Hello World");
form.append("Hello Micro World");
quit = new Command("Quit", Command.EXIT, 1);
Command lala = new Command("Flee", Command.BACK, 2);
// form.addCommand(lala);
form.addCommand(quit);
form.addCommand(lala);
form.setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable d) {
try {
if (c == quit) {
destroyApp(true);
notifyDestroyed();
}
} catch (Exception e) {
}
}
});
}
开发者ID:angelbirth,项目名称:gameloft,代码行数:23,代码来源:Midlet.java
示例7: showFatalErrorAndQuit
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
public void showFatalErrorAndQuit() {
Alert alert = new Alert("Fatal Error!", Log.getLogContent(), null, AlertType.ERROR);
alert.setTimeout(Alert.FOREVER);
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(alert);
alert.setCommandListener(new CommandListener() {
public void commandAction(javax.microedition.lcdui.Command command, Displayable displayable) {
synchronized (this){
this.notify();
}
}
});
try {
synchronized (this){
this.wait();
}
} catch (InterruptedException e) {
}
this.destroyApp(true);
}
开发者ID:csperle,项目名称:KeePassMobile,代码行数:20,代码来源:KeePassMobileMIDlet.java
示例8: forwardCommand
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
private void forwardCommand (Command c, Displayable d) {
CommandListener cl = listenerToReturnTo;
if (cl instanceof HandledCommandListener) {
((HandledCommandListener)cl)._commandAction(c, d);
} else {
cl.commandAction(c, d);
}
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:10,代码来源:AcquireScreen.java
示例9: ProgressScreen
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
public ProgressScreen(String title, String msg, CommandListener cmdListener, boolean continuous) {
super(title);
//#style focused
progressbar = new Gauge(msg, false, Gauge.INDEFINITE, continuous ? Gauge.CONTINUOUS_RUNNING : 0);
addCommand(CMD_CANCEL);
append(progressbar);
setCommandListener(cmdListener);
if (!continuous) {
updater_T = new HandledThread(new GaugeUpdater());
updater_T.start();
}
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:15,代码来源:ProgressScreen.java
示例10: FormTransportViews
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
public FormTransportViews(CommandListener observer, ItemStateListener stateListener, TransportResponseProcessor responder) {
super();
// this.mainMenu = constructMainMenu(observer);
// this.messageList = new FormTransportMessageList(observer);
this.loggingTextBox = createLoggingTextBox();
// this.messageDetailTextBox = new FormTransportMessageDetailBox(observer);
this.sendNowSendLater = new SendNowSendLaterForm(observer,stateListener);
this.submitStatusScreen = new FormTransportSubmitStatusScreen(observer, responder);
this.multiSubmitStatusScreen = new MultiSubmitStatusScreen(observer, responder);
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:13,代码来源:FormTransportViews.java
示例11: SendNowSendLaterForm
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
public SendNowSendLaterForm(CommandListener activity, ItemStateListener itemListener, boolean cacheAutomatically) {
//#style submitPopup
super(cacheAutomatically ? Localization.get("sending.view.done.title") : Localization.get("sending.view.submit"));
setCommandListener(activity);
if(!cacheAutomatically) {
//#style submitYesNo
this.cg = new ChoiceGroup(Localization.get("sending.view.when"), Choice.EXCLUSIVE);
setItemStateListener(itemListener);
// NOTE! These Indexes are optimized to be added in a certain
// order. _DO NOT_ change it without updating the static values
// for their numerical order.
this.cg.append(Localization.get("sending.view.now"), null);
this.cg.append(Localization.get("sending.view.later"), null);
append(this.cg);
} else {
//#style submitText
StringItem message = new StringItem(null, Localization.get("sending.view.done"));
this.append(message);
this.addCommand(commandOk);
}
//TODO: Add this back in for admin users. Who took it out?
//this.cg.append(Locale.get("sending.view.new"), null);// clients wont need to
// see
// this
append(new Spacer(80, 0));
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:36,代码来源:SendNowSendLaterForm.java
示例12: FormTransportSubmitStatusScreen
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
public FormTransportSubmitStatusScreen(CommandListener listener, TransportResponseProcessor responder) {
//#style submitPopup
super(Localization.get("sending.status.title"));
setCommandListener(listener);
this.responder = responder;
//#style submitText
this.msg = new StringItem(null, Localization.get("sending.status.going"));
append(new Spacer(80, 0));
append(this.msg);
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:12,代码来源:FormTransportSubmitStatusScreen.java
示例13: doDismiss
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
private void doDismiss() {
//selectedURL = "file:///" + currDirName + SEP_STR + currFile;
selectedURL = "file:///" + currDirName + currFile;
System.out.println("selURL: "+ currDirName + " "+ currFile);
CommandListener commandListener = getCommandListener();
if (commandListener != null) {
forwardCommand(SELECT_FILE_COMMAND, this);
}
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:10,代码来源:FileBrowser.java
示例14: forwardCommand
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
private void forwardCommand (Command c, Displayable d) {
CommandListener cl = getCommandListener();
if (cl instanceof HandledCommandListener) {
((HandledCommandListener)cl)._commandAction(c, d);
} else {
cl.commandAction(c, d);
}
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:10,代码来源:FileBrowser.java
示例15: getAcquireScreen
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
public AcquireScreen getAcquireScreen(CommandListener callingListener) {
String title = "Scan barcode";
//#if javarosa.usepolishlocalisation
//title = Locale.get( "title.ScanBarcode");
//#endif
BarcodeCaptureScreen bcScreen = new BarcodeCaptureScreen(
title, this, callingListener);
bcScreen.setBarcodeProcessor(barcodeProcessor);
return bcScreen;
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:11,代码来源:BarcodeQuestionWidget.java
示例16: ProgressScreenFormDownload
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
public ProgressScreenFormDownload(String title, String msg, CommandListener cmdListener) {
super(title, msg, cmdListener, true);
//#style capturingPopup
UiAccess.setStyle(this);
//#style capturingGauge
UiAccess.setStyle(progressbar);
}
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:9,代码来源:ProgressScreenFormDownload.java
示例17: showGui
import javax.microedition.lcdui.CommandListener; //导入依赖的package包/类
/**
*
* This method displays the desired GUI class
*
* @param gui
*/
public void showGui(Displayable gui){
// Saves a reference to the last displayed gui
lastGui = Display.getDisplay(this).getCurrent();
// Sets the new gui
Display.getDisplay(this).setCurrent(gui);
gui.setCommandListener((CommandListener)gui);
}
开发者ID:meisamhe,项目名称:GPLshared,代码行数:14,代码来源:RegistryMIDlet1.java
注:本文中的javax.microedition.lcdui.CommandListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论