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

📄 splashcanvas.java

📁 最强手机阅读器Anyview3.0版的界面代码
💻 JAVA
字号:
package com.ismyway.anyview.win;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import com.ismyway.anyview.others.Configure;
import com.ismyway.fairyui.Handset;
import com.ismyway.fairyui.MainCanvas;
import com.ismyway.fairyui.Panel;

public class SplashCanvas extends Canvas implements Runnable {
	private boolean getSize = false;
	private Image logo = null;

	public SplashCanvas() {
		setFullScreenMode(true);
		try {
			logo = Image.createImage("/res/logo.png");
		} catch (Exception e) {

		}
		new Thread(this).start();
	}

	protected void paint(Graphics g) {
		//System.out.println(">>" + MainCanvas.screenWidth + ", " + MainCanvas.screenHeight);

		if (null != logo) {
			for (int height = 0; height < getHeight(); height += 16) {
				for (int width = 0; width < getWidth(); width += 100) {
					g.setClip(width, height, 100, 16);
					g.drawImage(logo, width, height, 20);
				}
			}
			int x = (getWidth() - logo.getWidth()) >> 1;
			int y = (getHeight() - logo.getHeight()) >> 1;
			g.setClip(0, 0, getWidth(), getHeight());
			g.drawImage(logo, x, y, 20);
		} else {
			g.setColor(0);
			g.fillRect(0, getWidth(), 0, getHeight());
		}
		
		MainCanvas.screenWidth = getWidth();
		MainCanvas.screenHeight = getHeight();
		getSize = true;
	}

	public void run() {
		repaint();
		while (!getSize) {
			try {
				Thread.sleep(100L);
			} catch (Exception e) {

			}
		}

		logo = null;
		Configure.gc();

		MainCanvas screen = MainCanvas.getInstance();
		Handset.getDisplay().setCurrent(screen);
		Panel p = new Welcome();
		screen.setCurrent(p);
	}
}

⌨️ 快捷键说明

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