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

📄 hellomidlet.java

📁 这是j2me的例子,可供初学者学习,里面有源代码,是我写的
💻 JAVA
字号:
/*
 * HelloMIDlet.java
 *
 * Created on 2007年3月28日, 上午8:51
 */

package com.tan.ui;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 *
 * @author  USER
 * @version
 */
public class HelloMIDlet extends MIDlet implements CommandListener{
    private TextBox helloTextBox;
    private Command exitCommand;
    
    
    public void startApp() {
        init();
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }
    
    public void commandAction(Command command, Displayable displayable) {
        if(displayable == helloTextBox)
        {
            if(command == exitCommand)
            {
                Display.getDisplay(this).setCurrent(null);
                destroyApp(true);
                notifyDestroyed();
            }
        }
    }

    private void init() {
        Display.getDisplay(this).setCurrent(gethellBox());
    }
    
    
    private Command getExitCommand()
    {
        if(exitCommand == null)
        {
            exitCommand = new Command("Exit",Command.EXIT,1);
        }
        return exitCommand;
    }
    
    private TextBox gethellBox()
    {
        if(helloTextBox == null)
        {
            helloTextBox = new TextBox(null,"Text String",120,0x0);
            helloTextBox.addCommand(getExitCommand());
            helloTextBox.setCommandListener(this);
        }
        return helloTextBox;
    }
}

⌨️ 快捷键说明

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