Code:
/*
* Created on 2004-6-20
*
* Todo to change the template for this generated file go
* Window-preferences-Java-code style-code templates
*/
Package cn.edu. xtu. tilepuzzle. UI;
Import javax. microedition. lcdui. Command;
Import javax. microedition. lcdui. commandlistener;
Import javax. microedition. lcdui. display;
Import javax. microedition. lcdui. displayable;
Import javax. microedition. lcdui. form;
Import javax. microedition. lcdui. textfield;
Public class helpui implements commandlistener {
Private command btnexit;
Private command btnyes;
Private form formmain;
Private textfield txtcontent;
Private string helpcontent = "";
Private display;
Displayable;
Public helpui (display, displayable ){
// Super (title );
This. Display = display;
This. displayable = displayable;
Loadmainform ();
}
/*
* Initialize the main interface
*/
Void loadmainform (){
Helpcontent = "new game:" + "start a new game. \ N"
+ "Set image:" + "set the background image of the puzzle secret settings. \ N"
+ "Best score:" + "displays the best scores record by previous players. \ N"
+ "Option:" + "game settings: whether to display the row and column tags, or set the number of the row and column of the game. \ N"
+ "Help:" + "view the help documentation. \ N"
+ "Game reset:" + "sets the game to the status when it enters the game interface. \ N"
+ "Cheat:" + "players who have not finished playing the game immediately enter the game victory state. \ N"
+ "Other instructions:" + "......";
Formmain = new form ("game help ");
Txtcontent = new textfield ("Description:", helpcontent, 1000, 0 );
Btnexit = new command ("return", command. Exit, 1 );
Btnyes = new command ("OK", command. Exit, 0 );
Formmain. append (txtcontent );
/* Formmain. append (New textfield ("new game:", "start a new game. ", 120, 0 ));
Formmain. append (New textfield ("set image:", "sets the background image of the puzzle secret settings. ", 120, 0 ));
Formmain. append (New textfield ("Best score:", "shows the best scores record by previous players. ", 120, 0 ));
Formmain. append (New textfield ("option:", "some game settings: no display of row and column tags, set the number of rows and columns of the game, etc. ", 120, 0 ));
Formmain. append (New textfield ("Help:", "view help documentation. ", 120, 0 ));
Formmain. append (New textfield ("Game reset:", "sets the status of the game as it was just entering the game interface. ", 120, 0 ));
Formmain. append (New textfield ("cheat:", "the player enters the game victory status immediately after the game is not completed. ", 120, 0 ));
Formmain. append (New textfield ("other instructions:", "...", 120, 0 ));
*/
Formmain. addcommand (btnyes );
Formmain. addcommand (btnexit );
Formmain. setcommandlistener (this );
This. display. setcurrent (formmain );
}
/*
* Command processing
* @ See javax. microedition. lcdui. commandlistener # commandaction (javax. microedition. lcdui. Command, javax. microedition. lcdui. displayable)
*/
Public void commandaction (command, displayable display ){
If (command = btnexit | command = btnyes ){
This. display. setcurrent (displayable );
}
}
}
Running display