📄 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 + -