hellomidlet.java
来自「这是j2me的例子,可供初学者学习,里面有源代码,是我写的」· Java 代码 · 共 69 行
JAVA
69 行
/*
* 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 + =
减小字号Ctrl + -
显示快捷键?