📄 splashscreen.java
字号:
package com.jmobilecore.ui;
import com.jmobilecore.ui.core.PlatformCanvas;
import com.jmobilecore.ui.core.Color;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Graphics;
/**
* @author Greg Gridin
*/
abstract public class SplashScreen extends PlatformCanvas
implements Runnable {
protected Image splashImage = null;
protected long startTime = 0;
public SplashScreen(String _logoName) {
super();
try {
splashImage = Image.createImage(_logoName);
} catch (Exception ignored) {
}
}
/**
* Paints the logo to the screen.
*
* @param g The Graphics object to render to.
*/
synchronized protected void paint(Graphics g) {
g.setColor(Color.TRANSPARENT);
g.fillRect(0, 0, getWidth(), getHeight());
if (splashImage != null) {
g.drawImage(splashImage, getWidth() / 2, (getHeight() - splashImage.getHeight()) / 2, Graphics.HCENTER | Graphics.TOP);
}
startTime = System.currentTimeMillis();
(new Thread(this)).start();
}
synchronized public void hide(long timeout) {
long timeLeft = timeout;
if (startTime != 0)
timeLeft += startTime - System.currentTimeMillis();
if (timeLeft > 0) {
try {
wait(timeLeft);
} catch (Exception ignored) {
}
}
splashImage = null;
}
} // class SplashScreen
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -