📄 welcomeform.java
字号:
/********************************************************************
* 项目名称 :<b>j2me学习 J2me Wap Explorer</b> <br/>
*
* Copyright 2005-2006 Wuhua. All rights reserved </br>
*
* 本程序只用于学习目的,不能用于商业目的。如有需要请联系作者
********************************************************************/
package org.wuhua.wap.main;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;
import org.wuhua.wap.Resources;
import org.wuhua.wap.WapExplorer;
import org.wuhua.wap.ui.core.Platform;
import org.wuhua.wap.ui.form.Panel;
/**
* <b>类名:WelcomeForm.java</b> </br>
* 编写日期: 2006-12-25 <br/>
* 程序功能描述: <br/>
* Demo: <br/>
* Bug: <br/>
*
* 程序变更日期 :<br/>
* 变更作者 :<br/>
* 变更说明 :<br/>
*
* @author wuhua </br> <a href="mailto:rrq12345@163.com">rrq12345@163.com</a>
*/
public class WelcomeForm extends Panel implements Runnable{
private Font font_a = null; // 写logo的字
private Font font_b = null; // 写其他字
private boolean isLoad;
private int k[];
MIDlet midlet;
private int HEIGHT;
public WelcomeForm(MIDlet midlet) {
super(null);
font_a = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_ITALIC,
Font.SIZE_LARGE);
font_b = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN,
Font.SIZE_SMALL);
this.midlet = midlet;
k = new int[4];
new Thread(this).start();
HEIGHT = this.getHeight();
}
public void paint(Graphics g) {
//0x001E67
g.setColor(0x67686C);
g.fillRect(0, 0, Platform.WIDTH, HEIGHT);
g.setFont(font_a);
g.setColor(0xFFFFFF);
g.drawString("Wap Explorer", Platform.WIDTH /2, 10, Graphics.HCENTER | Graphics.TOP);
g.drawString("Wap Explorer", Platform.WIDTH /2+1, 10, Graphics.HCENTER | Graphics.TOP);
g.setFont(font_b);
g.drawImage(Resources.LOGO, Platform.WIDTH /2,40, Graphics.HCENTER | Graphics.TOP);
paintPoint(g);
//g.setColor(0xFFFFF);
g.drawString("作者:无花", 15, HEIGHT - 3 * font_b.getHeight() - 10, 0);
g.drawString("版权归无花所有", 15, HEIGHT - 2 * font_b.getHeight() - 10, 0);
//g.setColor(0xFFDB00);
//g.setFont(font_b);
g.drawString("http://wuhua.javaeye.com", 15, HEIGHT - 1 * font_b.getHeight() - 10,
0);
}
/**
* 绘制点来表示进度
*/
private void paintPoint(Graphics g) {
//g.setColor(0xFFFFFF);
if(!isLoad)
g.drawString("程序加载中.", 15, 90, 0);
else
g.drawString("按任意键进入.", 15, 90, 0);
//g.setColor(0x6B07C9);
for(int l1 = 0; l1 < k[0]; l1++){
g.fillRect(15 + l1 * 6, 100 + 12, 3, 3);
}
for(int i2 = 0; i2 < k[1]; i2++)
g.fillRect(15 + i2 * 6, 108 + 12, 3, 3);
for(int j2 = 0; j2 < k[2]; j2++)
g.fillRect(15 + j2 * 6, 116 + 12, 3, 3);
for(int k2 = 0; k2 < k[3]; k2++)
g.fillRect(15 + k2 * 6, 124 + 12, 3, 3);
}
protected void keyPressed(int keyCode) {
if(isLoad){
WapExplorer.openMainForm();
}
}
public void run() {
while(true){
if(!isLoad){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
changePinont();
this.repaint();
}else{
break;
}
}
}
private void changePinont(){
if(k[0]<12){
k[0] ++ ;
}else if(k[1] <20){
k[1] ++ ;
}else if(k[2] <26){
k[2] ++ ;
}else if(k[3] <32){
k[3] ++ ;
}
}
public void loadResource(){
isLoad = false;
Resources.loadImages(); // 载入系统所有图片文件
WapExplorer.initApplicationContent(midlet);
isLoad = true;
repaint();
}
protected void sizeChanged(int w, int h) {
if (h > HEIGHT) {
HEIGHT = h;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -