📄 gamemenu.java
字号:
package Darts;
import com.nttdocomo.ui.*;
/* Darts Title. */
/* 僎乕儉儊僯儏乕僷僱儖 */
public class GameMenu extends Panel implements ComponentListener,
SoftKeyListener {
private GameBase parent = null;
private Button newGameButton = new Button("New Game");
private Button endGameButton = new Button("End Game");
public GameMenu(GameBase _parent) {
this.parent = _parent;
setBackground( Color.SILVER );
setTitle( "Menu select." );
if ( parent.gameStat != parent.GS_GAMEOVER ) {
setSoftLabel( Frame.SOFT_KEY_2, "Exit" );
}
/* 儗僀傾僂僩儅僱乕僕儍偺愝掕 */
HTMLLayout lm = new HTMLLayout();
setLayoutManager(lm);
newGameButton.setSize( getWidth() / 2, getHeight() / 5 );
endGameButton.setSize( getWidth() / 2, getHeight() / 5 );
lm.begin( HTMLLayout.CENTER );
add( newGameButton );
add( endGameButton );
lm.end();
/* 僐儞億乕僱儞僩儕僗僫乕偲偟偰搊榐 */
setComponentListener( this );
/* 僜僼僩僉乕儕僗僫乕偲偟偰搊榐 */
setSoftKeyListener( this );
}
/* ComponentListener僀儞僞乕僼僃僀僗*/
public void componentAction(Component _src, int _type, int _key) {
if ( _src.equals( newGameButton ) == true ) {
parent.GameMenuClose( 1 );
}
if ( _src.equals( endGameButton ) == true ) {
parent.GameMenuClose( 2 );
}
}
public void softKeyPressed (int _key) {
if ( parent.gameStat != parent.GS_GAMEOVER ) {
if ( _key == Frame.SOFT_KEY_2 ) {
Display.setCurrent( parent );
}
}
}
/* not used */
public void softKeyReleased (int _key) {}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -