errorreport.java
来自「老外写的一个超厉害的手机游戏 , j2me , 开源项目」· Java 代码 · 共 71 行
JAVA
71 行
// style: tabs, tabsize=4, style=ANSI
//+----------------------------------------------------------------------+
// Copyright (c) 2006 Company Name
// Made by Andrew and Zahar
//+----------------------------------------------------------------------+
// Filename: ErrorReport.java
//+----------------------------------------------------------------------+
// Comment: Menu module to take control over paint() and keyPressed().
//+----------------------------------------------------------------------+
package app;
import app.GameMIDlet;
import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
public class ErrorReport implements CommandListener
{
private GameMIDlet mGameMIDlet;
private Command cmdOK;
private Command cmdCancel;
private Form mForm;
public ErrorReport(GameMIDlet m)
{
mGameMIDlet = m;
cmdOK = new Command("Ok", Command.OK, 1);
cmdCancel = new Command("Cancel", Command.CANCEL, 2);
}
public void ShowError(String sWhere, String sText )
{
if (mGameMIDlet!=null)
{
if ( mGameMIDlet.mCanvas != null )
{
//mGameMIDlet.mCanvas.PrepareForExit();
mGameMIDlet.mCanvas.setFullScreenMode(false);
}
}
System.gc();
mForm = new Form("-= Error =-");
mForm.append(
"Game failed in: \n" +sWhere+"\n"+
"Reason: \n" +sText+"\n"+
"Available memory: \n " + (Runtime.getRuntime()).freeMemory()+
"\nNow Game will exit.");
mForm.addCommand(cmdOK);
mForm.setCommandListener(this);
Display.getDisplay(mGameMIDlet).setCurrent(mForm);
}
public void commandAction(Command command, Displayable displayable)
{
if (command == cmdOK)
{
Display.getDisplay(mGameMIDlet).setCurrent((Displayable)null);
mGameMIDlet.destroyApp(true);
mGameMIDlet.notifyDestroyed();
/*Display.getDisplay(mMainCanvas.mMIDlet).setCurrent(mMainCanvas);
mMainCanvas.bPaused = false;
mMainCanvas = null;
mTextBox.removeCommand(cmdOK);
cmdOK = null;
mForm.setCommandListener(null);
mForm = null;*/
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?