当前位置: 首页>>代码示例>>Java>>正文


Java Command类代码示例

本文整理汇总了Java中javax.microedition.lcdui.Command的典型用法代码示例。如果您正苦于以下问题:Java Command类的具体用法?Java Command怎么用?Java Command使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Command类属于javax.microedition.lcdui包,在下文中一共展示了Command类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buttonize

import javax.microedition.lcdui.Command; //导入依赖的package包/类
private void buttonize(CommandUI cmd) {
	int which = 0;
	Command command = cmd.getCommand();
	if (command == Alert.DISMISS_COMMAND) {
		which = DialogInterface.BUTTON_NEUTRAL;
	} else {
		switch (command.getCommandType()) {
		case Command.OK:
			which = DialogInterface.BUTTON_POSITIVE;
			break;
		case Command.CANCEL:
			which = DialogInterface.BUTTON_NEGATIVE;
			break;
		}
	}
	if (which == 0) {
		alertDialog.setButton(command.getLabel(), onClickListener);
		which = DialogInterface.BUTTON_POSITIVE;
	} else {
		alertDialog.setButton(which, command.getLabel(), onClickListener);
	}
	buttons.put(which, cmd);
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:24,代码来源:AndroidAlertUI.java

示例2: setCommands

import javax.microedition.lcdui.Command; //导入依赖的package包/类
public void setCommands(Vector v) {
    if(currentCommands != null) {
        for(int iter = 0 ; iter < currentCommands.length ; iter++) {
            removeCommand(currentCommands[iter]);
        }
    }
    setCommandListener(this);
    currentCommands = new Command[v.size()];
    com.codename1.ui.Command backCommand = null;
    if(Display.getInstance().getCurrent() != null) {
        backCommand = Display.getInstance().getCurrent().getBackCommand();
    }
    for(int iter = 0 ; iter < currentCommands.length ; iter++) {
        com.codename1.ui.Command current = (com.codename1.ui.Command)v.elementAt(iter);
        if(current == backCommand) {
            currentCommands[iter] = new MIDP2CodenameOneCommand(current, Command.BACK, iter + 1);
        } else {
            if(iter == 0) {
                currentCommands[iter] = new MIDP2CodenameOneCommand(current, Command.OK, iter + 1);
            } else {
                currentCommands[iter] = new MIDP2CodenameOneCommand(current, iter + 1);
            }
        }
        addCommand(currentCommands[iter]);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:27,代码来源:GameCanvasImplementation.java

示例3: editString

import javax.microedition.lcdui.Command; //导入依赖的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

示例4: LogGui

import javax.microedition.lcdui.Command; //导入依赖的package包/类
public LogGui(){
	super("Log");
	// The log menu Commands
	showExceptionLog = new Command("Exception log", Command.ITEM, 4);
	showConnectionLog = new Command("Connection log", Command.ITEM, 4);
	showDataPackageLog = new Command("Data package log", Command.ITEM, 4);
	showDebugLog = new Command("Debug log", Command.ITEM, 4);
	displayLog = new Command("Full log", Command.ITEM, 1);
	hide = new Command("Hide log", Command.OK, 0);
	exit = new Command("Exit", Command.EXIT,0);

	addCommand(showExceptionLog);
	addCommand(showDataPackageLog);
	addCommand(showConnectionLog);
	addCommand(showDebugLog);
      	addCommand(displayLog);
	addCommand(hide);
	addCommand(exit);
}
 
开发者ID:meisamhe,项目名称:GPLshared,代码行数:20,代码来源:Peer2Messenger.java

示例5: SendGui

import javax.microedition.lcdui.Command; //导入依赖的package包/类
/**
 *
 * Constructor
 */
public SendGui(){
	super("Write a message");

	// Creating  the Commands
	sendTextPackage = new Command("Send",Command.ITEM,1);
	displayLog = new Command("View log",Command.ITEM,4);
	exit = new Command("Exit", Command.EXIT,0);
          search = new Command("Search", Command.OK, 1);
          input = new TextField("Message","",200,TextField.ANY);

	// The ChoiceGroup containing the connected Nodes
	connectedNodes = new ChoiceGroup("Choose recipients", Choice.MULTIPLE);

	// Adding the elements
          addCommand(sendTextPackage);
	addCommand(displayLog);
	addCommand(exit);
          addCommand (search)  ;
          append(connectedNodes);
	append(input);
}
 
开发者ID:meisamhe,项目名称:GPLshared,代码行数:26,代码来源:Peer2Messenger.java

示例6: commandAction

import javax.microedition.lcdui.Command; //导入依赖的package包/类
public void commandAction(Command c, Displayable d) {
    if (c == backCommand) {
        parent.displayThis();
    } else if (c == originalSignalCommand) {
        signalDrawer.setSignal(getOriginal());
        repaint();
    } else if (c == afterLowPassFilterSignalCommand) {
        signalDrawer.setSignal(getAfterLowPassFilter());
        repaint();
    } else if (c == afterHighPassFilterSignalCommand) {
        signalDrawer.setSignal(getAfterHighPassFilter());
        repaint();
    } else if (c == afterDerivativeFilterSignalCommand) {
        signalDrawer.setSignal(getAfterDerivativeFilter());
        repaint();
    } else if (c == afterSqueringFilterSignalCommand) {
        signalDrawer.setSignal(getAfterSqueringFilter());
        repaint();
    } else if (c == afterIntegrationFilterSignalCommand) {
        signalDrawer.setSignal(getAfterIntegrationFilter());
        repaint();
    }
}
 
开发者ID:kamcpp,项目名称:heart-diag-app,代码行数:24,代码来源:SignalCanvas.java

示例7: Midlet

import javax.microedition.lcdui.Command; //导入依赖的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

示例8: _commandAction

import javax.microedition.lcdui.Command; //导入依赖的package包/类
public void _commandAction(Command command, Displayable arg1) {

        if (command == cancelCommand) {
            cleanUp();
            forwardCommand(command, arg1);

        } else if (command == setCallingScreenDataCommand) {
            IAnswerData data = this.getAcquiredData();
            if (data != null) {
                questionScreen.setAcquiredData(data);
                _commandAction(cancelCommand, this);
            }

        } else {
            handleCustomCommand(command, arg1);
        }

    }
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:19,代码来源:AcquireScreen.java

示例9: ConnectGui

import javax.microedition.lcdui.Command; //导入依赖的package包/类
/**
       *
       * Constructor
       */
public ConnectGui(){
	super("Nodes");

	// The ChoiceGroup
	nodes = new ChoiceGroup("Choose the node(s) to connect to",Choice.MULTIPLE);

          	nodeAddressList = new Hashtable();

	// The Commands
	back = new Command("Back",Command.BACK,1);
	displayLog = new Command("Display log",Command.ITEM,4);
	connect = new Command("Connect",Command.ITEM,0);
	exit = new Command("Exit", Command.EXIT,0);

	addCommand(back);
          addCommand(connect);
	addCommand(displayLog);
	addCommand(exit);
	// Adds the ChoiceGroup
	append(nodes);

}
 
开发者ID:meisamhe,项目名称:GPLshared,代码行数:27,代码来源:Peer2Messenger.java

示例10: commandAction

import javax.microedition.lcdui.Command; //导入依赖的package包/类
public void commandAction(Command cmd, Displayable disp) {
	//#debug info
	System.out.println("commandAction with cmd=" + cmd.getLabel() + ", screen=" + disp );
	if (cmd == this.backCommand) {
		display.setCurrent(mainScreen);
	} else if (cmd == this.exitCommand) {
		//#debug info
		System.out.println("Exit application");
		this.notifyDestroyed();
	} else if (cmd == this.aboutCommand) {
		String param = this.getAppProperty("Xfolite-Version");
     	Alert alert = new Alert(
     			Locale.get("main.label.about"),
     			Locale.get("main.msg.about", param),
     			null,
     			AlertType.INFO);
 		// Looks like an error but builds
 		this.display.setCurrent(alert, mainScreen);
     }
}
 
开发者ID:okoskimi,项目名称:Xfolite,代码行数:21,代码来源:XFormsMidlet.java

示例11: showSuspendAlert

import javax.microedition.lcdui.Command; //导入依赖的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

示例12: _commandAction

import javax.microedition.lcdui.Command; //导入依赖的package包/类
public void _commandAction(Command comm, Displayable disp) {
    if (comm == locView.cancelCommand) {
        transitions.captureCancelled();
    } else if (comm == locView.okCommand) {
        if (locService.getStatus() == LocationCaptureService.FIX_OBTAINED)
        {
            interrupted=true;
            transitions.captured(myLoc);
        }
        else
            transitions.captureCancelled();
    } else if (comm == locView.retryCommand) {
        captureThread = new HandledThread(this, "CaptureThread");
        captureThread.start();
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:17,代码来源:LocationCaptureController.java

示例13: EntitySelectDetailPopup

import javax.microedition.lcdui.Command; //导入依赖的package包/类
public EntitySelectDetailPopup (EntitySelectController<E> psa, Entity<E> entity, EntitySet<E> set) {
    //#style entityDetailScreen
    super(Localization.get("entity.detail.title", new String[] {entity.entityType()}));

    this.psa = psa;

    recordID = entity.getRecordID();
    headers = entity.getHeaders(true);
    data = entity.getLongFields(set.get(recordID));
    forms = entity.getLongForms(false);

    phoneCallouts = new Command[data.length];

    okCmd = new Command(Localization.get("command.ok"), Command.OK, 1);
    backCmd = new Command(Localization.get("command.back"), Command.BACK, 1);
    addCommand(okCmd);
    addCommand(backCmd);
    setCommandListener(this);

    loadData();
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:22,代码来源:EntitySelectDetailPopup.java

示例14: setupCommands

import javax.microedition.lcdui.Command; //导入依赖的package包/类
private void setupCommands() {
	addNote = new Command("Add", Command.SCREEN, 0);
	exit = new Command("Exit", Command.EXIT, -1);
	sortByCategory = new Command("By Cat.", Command.SCREEN, 0);
	sortByPriority = new Command("By Prior.", Command.SCREEN, 0);
	sortByTime = new Command("By Time", Command.SCREEN, 0);
	addCommand(addNote);
	addCommand(exit);
	addCommand(sortByCategory);
	addCommand(sortByPriority);
	addCommand(sortByTime);
	setCommandListener(this);
}
 
开发者ID:NotesTeam,项目名称:TaskBook-J2ME,代码行数:14,代码来源:NotesList.java

示例15: commandAction

import javax.microedition.lcdui.Command; //导入依赖的package包/类
public void commandAction(Command c, Displayable d) {
	if (c == List.SELECT_COMMAND)
		showNoteDetails();
	else if (c == addNote) 
		addNewNote();
	else if (c == sortByCategory)
		sortListByCategory();
	else if (c == sortByPriority)
		sortListByPriority();
	else if (c == sortByTime)
		sortListByTime();
	else if (c == exit)
		exitApplication();
}
 
开发者ID:NotesTeam,项目名称:TaskBook-J2ME,代码行数:15,代码来源:NotesList.java


注:本文中的javax.microedition.lcdui.Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。