📄 helloworld.java
字号:
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
public class HelloWorld extends Canvas implements Runnable {
Main _midlet;
public HelloWorld(Main midlet) {
// TODO Auto-generated constructor stub
_midlet = midlet;
s_bRunning = true;
_midlet.dis.setCurrent(this);
setFullScreenMode(true);
Thread mainThread = new Thread(this);
mainThread.start();
}
static Graphics s_g;
protected void paint(Graphics g) {
// TODO Auto-generated method stub
s_g = g;
if (!s_bEnterWorld) {
s_bEnterWorld = true;
s_g.setColor(0xFF00FF00);
s_g.fillRect(0, 0, this.getWidth(), this.getHeight());
s_g.setColor(0xFFFF0000);
s_g.drawString("Hello World", this.getWidth() >> 1, this
.getHeight() >> 1, Graphics.TOP | Graphics.LEFT);
}
}
public void run() {
// TODO Auto-generated method stub
while (s_bRunning) {
repaint();
serviceRepaints();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
static boolean s_bRunning = false;
boolean s_bEnterWorld = false;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -