fullscreenmidlet.java.svn-base

来自「example2 众多JAVA实例源码...学习java基础的好帮手」· SVN-BASE 代码 · 共 43 行

SVN-BASE
43
字号
package opusmicro.demos.canvas;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
/**
 * How to set canvas display as full screen
 */
public class FullScreenMIDlet extends MIDlet {
	public FullScreenMIDlet() {}
	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {}
	protected void pauseApp() {}
	protected void startApp() throws MIDletStateChangeException {
		Display.getDisplay(this).setCurrent(new FullScreenCanvas());
	}
}
class FullScreenCanvas extends Canvas{
	public FullScreenCanvas(){
		this.setFullScreenMode(true);
	}
	protected void paint(Graphics g) {
		g.setColor(0xeefafa);
		g.fillRect(0, 0, getWidth(), getHeight());
	}
	public int getHeight(){
		  try{
			  if("Nokia6600".compareTo(System.getProperty("microedition.platform").substring(0,9)) == 0)
				  return 208;
			  else
				  return super.getHeight();
		  }
		  catch(Exception e){
			  return super.getHeight();
		  }
		}
	protected final void sizeChanged(int w, int h){
		if(w>getWidth()){
			
		}
	}
}

⌨️ 快捷键说明

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