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

📄 listing15-02_gamemidlet.java_dynamicprogramming

📁 着几乎所有智能机厂商都将有自己配套的App Store,甚至并非智能手机制造商的三星也有意加入本次混战. 当然,我们也不能忘记苹果最先从iTunes中得到的灵感,从而带来了应用程序商店,一个正确
💻 JAVA_DYNAMICPROGRAMMING
字号:
//Listing 15-2. Implementing a Full Screen Dynamically

package com.apress.dynamic;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class GameMidlet extends MIDlet {
private Display display;

public GameMidlet() {
}

public void startApp() {
	this.display = Display.getDisplay( this );
	Canvas splash;

		// check if this device supports the MIDP 2.0 standard:
	try {
		Class.forName("javax.microedition.io.PushRegistry");
		// okay, MIDP 2.0 standard is supported:
		splash = (Canvas) Class.forName
			("com.apress.dynamic.Midp2Splash").newInstance();
	} catch (Exception e) {
		// the MIDP 2.0 standard is not supported
		// check if this device supports the Nokia-UI-API:
		try {
			Class.forName("com.nokia.mid.ui.FullCanvas");
			splash = (Canvas) Class.forName
				("com.apress.dynamic.NokiaUiSplash").newInstance();
		} catch (Exception e2) {
			// okay, neither MIDP 2.0 nor Nokia UI API is supported:
			splash = new Midp1Splash();
		}
	}

	// show the splash screen:
	this.display.setCurrent( splash );
	}

	public void destroyApp( boolean unconditional ) {
	}

	public void pauseApp() {
	}
}


// the normal MIDP 1.0 splash screen:
package com.apress.dynamic;
import javax.microedition.lcdui.*;
public class Midp1Splash extends Canvas {
	public void paint( Graphics g ) {
		g.drawString("Starting!", getWidth()/2, getHeight()/2,
			Graphics.HCENTER | Graphics.BASELINE );
	}
}


// the MIDP 2.0 splash screen:
package com.apress.dynamic;
import javax.microedition.lcdui.*;
public class Midp2Splash extends Canvas {
	public void paint( Graphics g ) {
		setFullScreenMode( true );
		g.drawString("Starting!", getWidth()/2, getHeight()/2,
			Graphics.HCENTER | Graphics.BASELINE );
	}
}


// the Nokia UI API splash screen:
package com.apress.dynamic;
import javax.microedition.lcdui.*;
import com.nokia.mid.ui.FullCanvas;
public class NokiaSplash extends FullCanvas {
	public void paint( Graphics g ) {
		g.drawString("Starting!", getWidth()/2, getHeight()/2,
			Graphics.HCENTER | Graphics.BASELINE );
	}
}

⌨️ 快捷键说明

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