?? diamandmidlet.java
字號:
package russiandiamand;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
public class DiamandMIDlet
extends MIDlet
{
private static DiamandMIDlet instance;
public static DiamandCanvas diamandCanvas = new DiamandCanvas();
public static HighScoreForm highScoreForm = new HighScoreForm();
public static Display display;
// public static String highScore = "0";
final String recordStoreName = "DiamandScore";
/** Constructor */
public DiamandMIDlet()
{
instance = this;
display = Display.getDisplay(this);
}
/** Main method */
public void startApp()
{
try
{
RecordStore rs = RecordStore.openRecordStore(recordStoreName, false);
int recordCount = rs.getNumRecords();
String highScore = new String(rs.getRecord(1));
highScoreForm.setScore(highScore);
rs.closeRecordStore();
}
catch (RecordStoreException ex)
{
System.out.println(ex);
}
Display.getDisplay(this).setCurrent(diamandCanvas);
}
/** Handle pausing the MIDlet */
public void pauseApp()
{
}
/**
* Handle destroying the MIDlet
* @param unconditional unconditional
*/
public void destroyApp(boolean unconditional)
{
try
{
RecordStore.deleteRecordStore(recordStoreName);
}
catch (RecordStoreException ex)
{
System.out.println(ex);
}
try
{
RecordStore rs = RecordStore.openRecordStore(recordStoreName, true);
String highScore = highScoreForm.getScore();
rs.addRecord(highScore.getBytes(), 0, highScore.length());
rs.closeRecordStore();
}
catch (RecordStoreException ex)
{
System.out.println(ex);
}
}
/** Quit the MIDlet */
public static void quitApp()
{
instance.destroyApp(true);
instance.notifyDestroyed();
instance = null;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -