⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 titlepanel.java

📁 DoCoMo 手机Java源码 4人游戏用 Cricket
💻 JAVA
字号:
package Darts;

import com.nttdocomo.ui.*;

/* Darts Title. */
/* 偙偺傾僾儕偺僞僀僩儖僷僱儖 */

public class TitlePanel extends Panel
                        implements ComponentListener{

    private Darts parent = null;

    private Label title          = new Label( "- DARTS -" );
    private Button countUpButton = new Button( "Count Up" );
    private Button zeroOneButton = new Button( "01" );
    private Button cricketButton = new Button( "Cricket" );
    private Button OptionButton  = new Button( "Option" );
    private Button exitButton    = new Button( "Exit" );

    public TitlePanel(Darts _parent) {
        this.parent = _parent;

        /* 儗僀傾僂僩儅僱乕僕儍偺愝掕 */
        HTMLLayout lm = new HTMLLayout();
        setLayoutManager(lm);

        /* 僷僱儖偺攚宨怓傪愝掕 */
        setBackground(Color.BLACK);

        /* 儔儀儖偺愝掕 */
        title.setForeground( Color.RED );
        title.setBackground( Color.BLACK );

        /* 奺儃僞儞偺愝掕 */
        countUpButton.setSize( getWidth() / 2, getHeight() / 10 );
        zeroOneButton.setSize( getWidth() / 2, getHeight() / 10 );
        cricketButton.setSize( getWidth() / 2, getHeight() / 10 );
        OptionButton.setSize ( getWidth() / 2, getHeight() / 10 );
        exitButton.setSize   ( getWidth() / 2, getHeight() / 10 );

        countUpButton.setEnabled( false );
        zeroOneButton.setEnabled( false );

        /* 奺儃僞儞偺攝抲 */
        lm.begin( HTMLLayout.CENTER );
            add( title );
            lm.br();
            lm.br();
            add( countUpButton );
            add( zeroOneButton );
            add( cricketButton );
            lm.br();
            lm.br();
            lm.br();
            add( OptionButton  );
            add( exitButton    );
        lm.end();

        /* 僐儞億乕僱儞僩儕僗僫乕偲偟偰搊榐 */
        setComponentListener(this);
    }

    /* ComponentListener僀儞僞乕僼僃僀僗*/
    public void componentAction(Component _src, int _type, int _key) {
        if ( _src.equals( countUpButton ) == true ) {
            parent.playCountUp();
        }
        if ( _src.equals( zeroOneButton ) == true ) {
            parent.playZeroOne();
        }
        if ( _src.equals( cricketButton ) == true ) {
            parent.playCricket();
        }
        if ( _src.equals( OptionButton ) == true ) {
            parent.showOptionPanel();
        }
        if ( _src.equals( exitButton ) == true ) {
            Dialog dialog = new Dialog(Dialog.DIALOG_YESNO, "廔椆妋擣");
            dialog.setText("傾僾儕働乕僔儑儞傪廔椆偟傑偡丅\n傛傠偟偄偱偡偐丠\n\n");
            int ans = dialog.show();
            if (Dialog.BUTTON_YES == ans) {
                IApplication.getCurrentApp().terminate();
            }
        }
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -