water.java
来自「J2ME的游戏原代码!希望能帮助有需要帮助的师兄弟们!」· Java 代码 · 共 88 行
JAVA
88 行
// water version 02
// coded by Tota/tomato interactive
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
//Midp class
public class water extends MIDlet implements CommandListener {
private Display display;
private Command exit;
private Command helpCommand;
private Command inputmode;
String msg;
public static MyCanvas canvas;
public static TextFieldForm form;
/* Start Addition 17-03-2003 for external events */
private boolean firstTime;
/* End Addition 17-03-2003 */
public water(){
display = Display.getDisplay(this);
exit=new Command("Exit",Command.EXIT,1);
helpCommand =new Command("Help",Command.SCREEN,2);
/* Start Modified 17-03-2003 input -> Input */
inputmode = new Command("Input",Command.SCREEN,3);
/* End Modified 17-03-2003 */
msg = "drip";
}
/* start */
public void startApp(){
/* Start Modified 17-03-2003 for external events */
if(!firstTime){
form = new TextFieldForm(this);
canvas=new MyCanvas(msg);
canvas.addCommand(exit);
canvas.addCommand(helpCommand);
canvas.addCommand(inputmode);
canvas.setCommandListener(this);
display.setCurrent(canvas);
firstTime = true;
}else {
canvas.onoff = true;
}
/* End Modified 17-03-2003 */
}
public void pauseApp()
{
/* Start Addition 20-03-2003 */
canvas.onoff = false;
/* End Addition 20-03-2003 */
}
public void destroyApp(boolean unconditional)
{
}
public void resetScreen(){
display.setCurrent(canvas);
}
public void commandAction(Command c,Displayable s)
{
if (c==exit)
{
destroyApp(false);
notifyDestroyed();
}else if(c== helpCommand){
/* Start Modified 17-03-2003 for help text */
Alert alert=new Alert("Help","Push the joystick to trigger drips."
,null,AlertType.INFO);
//Alert alert=new Alert("help","press(enter) to trigger a drip",null,AlertType.INFO);
/* End Modified 17-03-2003 */
alert.setTimeout(Alert.FOREVER);
display.setCurrent(alert);
}else if(c == inputmode){
display.setCurrent(form);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?