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


Java Form.setCommandListener方法代码示例

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


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

示例1: startApp

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
public void startApp() {
    if (isInitialized) {
        return;
    }
    
    form = new Form("Heart Diag Application");
    form.append(textFieldSampleUrl);
    form.append(stringItemStatus);
    signalItem.setPreferredSize(form.getWidth(), form.getHeight() - textFieldSampleUrl.getPreferredHeight() - stringItemStatus.getPreferredHeight());
    form.append(signalItem);
    form.addCommand(exitCommand);
    form.addCommand(chooseCommand);
    form.addCommand(drawCommand);
    form.setCommandListener(this);
    Display.getDisplay(this).setCurrent(form);
    alert.addCommand(new Command("Back", Command.SCREEN, 1));
    isInitialized = true;
}
 
开发者ID:kamcpp,项目名称:heart-diag-app,代码行数:19,代码来源:HeartDiagAppMidlet.java

示例2: Midlet

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

示例3: SubmitForm

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
/**
 * Constructor ErrorPrompt. 
 *
 * @param  parent  ...
 */
public SubmitForm(MIDlet parent, LSClient client, ErrorPrompt errorPrompt) {
    this.errorPrompt = errorPrompt; 
    this.client = client;
    
    messageListener = new SentListener();
    
    close = new Command("Back", Command.STOP, 2);
    send = new Command("Send", Command.OK, 1);
    
    sendForm = new Form("RoundTrip Form");
    
    text = new TextField("Write message","",100,TextField.ANY);
    sendForm.append(text);

    field = new ChoiceGroup("Select Item",Choice.EXCLUSIVE,new String[]{"1","2","3","4","5"},null);
    sendForm.append(field);
    
    sendForm.addCommand(close);
    sendForm.addCommand(send);
    

    sendForm.setCommandListener(this);
    midlet = parent;
    reset();
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-StockList-client-midlet,代码行数:31,代码来源:SubmitForm.java

示例4: ErrorPrompt

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
/**
 * Constructor ErrorPrompt. 
 *
 * @param  parent  ...
 */
public ErrorPrompt(MIDlet parent) {
    close = new Command("Back", Command.STOP, 2);
    clear = new Command("Clear", Command.OK, 1);
    changeLimit = new Command("Disable/Enable log limit", Command.OK, 1);

    errorForm = new Form("Error Form");

    errorForm.addCommand(close);
    errorForm.addCommand(clear);
    errorForm.addCommand(changeLimit);

    errorForm.setCommandListener(this);
    midlet = parent;
    reset();
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-StockList-client-midlet,代码行数:21,代码来源:ErrorPrompt.java

示例5: startApp

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
public void startApp() {
    if (isInitialized) {
        return;
    }
    form = new Form("Heart Diag Application");
    form.append(textFieldSampleUrl);
    form.append(stringItemStatus);
    form.addCommand(exitCommand);
    form.addCommand(chooseCommand);
    form.setCommandListener(this);
    Display.getDisplay(this).setCurrent(form);
    alert.addCommand(new Command("Back", Command.SCREEN, 1));
    isInitialized = true;
}
 
开发者ID:kamcpp,项目名称:heart-diag-app,代码行数:15,代码来源:HeartDiagAppMidlet.java

示例6: showDetails

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
private void showDetails() {
    Form details = new Form(Localization.get("network.test.details.title"));
    for(String s: messages) {
        details.append(s);
    }
    details.addCommand(back);
    details.setCommandListener(this);
    J2MEDisplay.setView(details);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:10,代码来源:GPRSTestState.java

示例7: start

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
public void start () {
    view = new Form("Permissions test");
    exit = new Command("OK", Command.BACK, 0);
    view.setCommandListener(this);
    view.addCommand(exit);
    J2MEDisplay.setView(view);

    final PermissionsTestState parent = this;
    new HandledThread () {
        public void _run () {
            permissionsTest(parent);
        }
    }.start();
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:15,代码来源:PermissionsTestState.java

示例8: showAbout

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
private void showAbout()
{
    Form about = new Form("");
    about.append(new ImageItem(null, img, ImageItem.LAYOUT_NEWLINE_AFTER
            | ImageItem.LAYOUT_NEWLINE_BEFORE | ImageItem.LAYOUT_CENTER,
            null));
    about.append(new StringItem("jSimpleDice MIDlet by k", null));
    about.append("\njsimpledice.sf.net");
    about.append(new StringItem("\njava.util.Random by",
            "J2ME MIDP 1.0 Specs"));
    about.addCommand(homeCommand);
    about.setCommandListener(this);
    display.setCurrent(about);
}
 
开发者ID:camila,项目名称:sf-java,代码行数:15,代码来源:JSimpleDiceMIDlet.java

示例9: showMessage

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
public void showMessage(String title, String message) {
	messageForm = new Form(title);
	messageForm.append(message);
	messageForm.setCommandListener(this);
	messageForm.addCommand(new Command("Back", Command.BACK, 0));
	display.setCurrent(messageForm);
}
 
开发者ID:Summeli,项目名称:vNes-Asha,代码行数:8,代码来源:vNes.java

示例10: CameraImage

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
/** Creates a new instance of CameraImage
 * @param imgListener
 */
public CameraImage(VirtualList parentList, CameraImageListener imgListener/*, String sizes*/) {
    this.imgListener = imgListener;
    this.parentList = parentList;

    //if (sizes!=null) this.sizes=sizes;
    
    int exp=0;
    try {
        String uri= Config.getInstance().NokiaS40 ? "capture://image" : "capture://video";
        player = Manager.createPlayer(uri);
        player.realize();
        
        videoControl = (VideoControl)player.getControl("VideoControl");
        
        Form form = new Form("Camera");
        Item item = (Item)videoControl.initDisplayMode(
                GUIControl.USE_GUI_PRIMITIVE, null);
        form.append(item);
        form.addCommand(cmdShot);
        form.addCommand(cmdCancel);
        form.setCommandListener(this);
        midlet.BombusMod.getInstance().setDisplayable(form);
        
        player.start();
    } catch (Exception e) {
    }
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:31,代码来源:CameraImage.java

示例11: createConfigPanel

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
/**
* createConfigPanel
* Build the lcdui display. Add the necessary fields to
* a form and return the completed Displayable object.
*/
  public void createConfigPanel() {
  	if ( configPanel == null ) {
	Item[] items = new Item[3];
	String ipAddress = "127.0.0.1";
	String portNum = "1883";
	String clientId = "MQTT_MIDLET";

	// Query the record store (if we have opened it) for any previously set
	// IP address, port number or client identifier
	if ( config != null ) {
		byte[] ip   = null;
		byte[] port = null;
		byte[] cid = null;
		try {
			ip   = config.getRecord(1);
			if ( ip != null ) {
				ipAddress =  new String(ip);
			}
			port = config.getRecord(2);
			if ( port != null ) {
				portNum =  new String(port);
			}
			cid = config.getRecord(3);
			if ( cid != null ) {
				clientId =  new String(cid);
			}
		} catch ( RecordStoreException rse ) {
			// Don't worry if something fails. The user can enter the information again
		}
	}

	// Build up the GUI objects
	TextField t1 = new TextField( "Client Id", clientId, 100, TextField.ANY );
	TextField t2 = new TextField( "IP address", ipAddress, 100, TextField.ANY );
	TextField t3 = new TextField( "IP port", portNum, 4, TextField.NUMERIC );

	items[IDX_CLIENT_ID] = (Item)t1;
	items[IDX_IP_ADDR] = (Item)t2;
	items[IDX_PORT_NUM] = (Item)t3;
	Form f = new Form( "Connection", items );

	f.addCommand( connect );
	f.addCommand( cancel );
      
	f.setCommandListener( this );

	configPanel = f;
	Display.getDisplay(this).setCurrent( configPanel );
  	}
  }
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:56,代码来源:IA92.java

示例12: start

import javax.microedition.lcdui.Form; //导入方法依赖的package包/类
public void start () {
    view = new Form("logs");

    view.setCommandListener(this);

    exit = new Command("OK", Command.BACK, 1);

    submit = new Command("Send to Server", Command.SCREEN, 0);

    ok = new Command("OK", Command.SCREEN, 0);

    loadLogs();

    J2MEDisplay.setView(view);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:16,代码来源:LogViewerState.java


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