The entire process of rapid development of j2-game (5)-game help Interface

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.