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

📄 menu.java

📁 可在索爱K700C上运行的3D例程
💻 JAVA
字号:
/**
 * 
 * COPYRIGHT All rights reserved Sony Ericsson Mobile Communications AB 2004. 
 * 
 * The software is the copyrighted work of Sony Ericsson Mobile Communications AB. 
 * The use of the software is subject to the terms of the end-user license agreement which 
 * accompanies or is included with the software. The software is provided "as is" and Sony Ericsson 
 * specifically disclaim any warranty or condition whatsoever regarding merchantability or fitness for 
 * a specific purpose, title or non-infringement. No warranty of any kind is made in relation to the condition, 
 * suitability, availability, accuracy, reliability, merchantability and/or non-infringement of the software provided herein
 *
 */
package com.sonyericsson.javatest.mobile3d;

import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.TextBox;

/**
 * This menu is displayed ater user presses any key. Menu allows user to select; view device statistics, run demo again
 * or exit application.
 */
public class Menu implements CommandListener {

    static final Command backCommand = new Command("Back", Command.BACK, 0);

    static final String menuLabelExit = Mobile3D.getInstance().getStringExit();

    static final String menuLabelRun = "Run Demo";

    static final String menuLabelStatistics = "View statistics";

    static final Command selectCommand = new Command("Select", Command.ITEM, 3);

    Display display = null;

    TextBox input = null;

    /**
     * main menu with items
     */ 
    List menu = null;

    public Menu() {

        menu = new javax.microedition.lcdui.List(Mobile3D.getInstance().getStringAppName(), Choice.IMPLICIT);
        try {
            menu.append(menuLabelRun, Image.createImage("/icons/icon9.png"));
            menu.append(menuLabelStatistics, Image.createImage("/icons/icon_info.png"));
            menu.append(menuLabelExit, Image.createImage("/icons/icon7.png"));

        } catch (Exception e) {
            System.err.println("Menu images not found!");
        }
        menu.addCommand(selectCommand);

        menu.setSelectCommand(selectCommand);
        menu.setSelectedIndex(0, true);
        menu.setCommandListener(this);
        Display dis = Display.getDisplay(Mobile3D.getInstance());
        dis.setCurrent(menu);

    }

    /**
     * Handle selection events.
     */
    public void commandAction(Command c, Displayable d) {

        switch (menu.getSelectedIndex()) {
        case 0:
            	Mobile3D.loadDemo();
            break;
        case 1:
            	viewInfo();
            break;
        case 2:
            Mobile3D.quitApp();
         break;
        }

    }

    /**
     * Display the information page
     *  
     */
    public void viewInfo() {
        InfoPage ipage = new InfoPage("Information");
        Display dis = Display.getDisplay(Mobile3D.getInstance());
        dis.setCurrent(ipage);
    }
}

⌨️ 快捷键说明

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