gamedialogboxtest.java

来自「j2me游戏引擎 j2me游戏引擎」· Java 代码 · 共 52 行

JAVA
52
字号
package cn.org.matrix.gmatrix.practice.demo01;

import javax.microedition.lcdui.Font;
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.Display;
import cn.org.matrix.gmatrix.gameLab.util.ui.*;
import cn.org.matrix.gmatrix.gameLab.control.*;
/**
 * GameDialogBox测试类
 * @author cleverpig
 *
 */
public class GameDialogBoxTest extends MIDlet{
	
	public void startApp(){
		Description des=new Description();
		des.setCols(20);
		des.setRows(1);
		des.setContent("对话框测试文字");
		des.setContentColor(0x00ffff);
		des.setFont(Font.getDefaultFont());
		
		GameDialogBox gdb=new GameDialogBox();
		int bgColor=0xff0000;
		int uibgColor=0xff000f;
		int borderColor=0xffff00;
		gdb.getColorScheme().setBgColor(bgColor);
		gdb.getColorScheme().setUIBgColor(uibgColor);
		gdb.getColorScheme().setUIBorderColor(borderColor);
		gdb.setDescription(des);
		gdb.setAffirmKey(KeyManager.OK_KEYPRESS);
		gdb.setCancelKey(KeyManager.CANCEL_KEYPRESS);
		gdb.getScope().setUIHeight(gdb.getHeight()/2);
		gdb.getScope().setUIWidth(gdb.getWidth()/2);
		gdb.getScope().setLeftTopCoordinates(gdb.getWidth()/4,gdb.getHeight()/4);
		gdb.setStuffingHeight(10);
		gdb.setStuffingWidth(10);
		gdb.setType(GameDialogBox.CLOSE_UNTILTIMEOUT);
		gdb.setWaitTime(2000);
		Thread gdbTh=new Thread(gdb);
		gdbTh.start();
		Display.getDisplay(this).setCurrent(gdb);
		
	}
	
	public void pauseApp(){
	}
	
	public void destroyApp(boolean force){
	}
}

⌨️ 快捷键说明

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