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

📄 optionpanel.java

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

import com.nttdocomo.ui.*;

/* Darts Option. */
/* 偙偺傾僾儕偺愝掕僷僱儖 */

public class OptionPanel extends Panel
                         implements SoftKeyListener {

    private Darts parent = null;

    private static final String selectPlayer[]  = { "1", "2", "3", "4" };
    private static final String selectZeroOne[] = { "301", "501", "701",
                                                    "901", "1301", "1501" };
    private static final int zeroOneRound[]  = { 10, 15, 20, 20, 20, 20 };

    private Label title        = new Label( "- Option -" );
    private Label playerTitle  = new Label( "Player Select" );
    private Label zeroOneTitle = new Label( "01 Select" );
    private ListBox playerCnt  = new ListBox( ListBox.CHOICE );
    private ListBox zeroOneNum = new ListBox( ListBox.CHOICE );

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

        setSoftLabel( Frame.SOFT_KEY_2, "Exit" );

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

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

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

        /* 儕僗僩偺愝掕 */
        playerCnt.setItems ( selectPlayer );
        zeroOneNum.setItems( selectZeroOne );
        playerCnt.select   ( 1 );
        zeroOneNum.select  ( 1 );

        /* 奺儃僞儞偺愝掕 */
        playerCnt.setSize ( getWidth() / 5, getHeight() / 10 );
        zeroOneNum.setSize( getWidth() / 5, getHeight() / 10 );
        playerCnt.setBackground ( Color.SILVER );
        zeroOneNum.setBackground( Color.SILVER );
        playerCnt.setForeground ( Color.BLACK );
        zeroOneNum.setForeground( Color.BLACK );

        /* 奺儃僞儞偺攝抲 */
        lm.begin( HTMLLayout.CENTER );
            add( title );
            lm.br();
            lm.br();
            add( playerTitle );
            lm.br();
            add( playerCnt  );
            lm.br();
            lm.br();
            add( zeroOneTitle );
            lm.br();
            add( zeroOneNum );
        lm.end();

        /* 僜僼僩僉乕儕僗僫乕偲偟偰搊榐 */
        setSoftKeyListener( this );
    }

    public int getPlayerCnt() {
        return Integer.parseInt( selectPlayer[playerCnt.getSelectedIndex()] );
    }

    public int getZeroOneNum() {
        return Integer.parseInt( selectZeroOne[zeroOneNum.getSelectedIndex()] );
    }

    public int getZeroOneRound() {
        return zeroOneRound[zeroOneNum.getSelectedIndex()];
    }

    public void softKeyPressed (int _key) {
        if ( _key == Frame.SOFT_KEY_2 ) {
            parent.showTitlePanel();
        }
    }

/* not used */
    public void softKeyReleased (int _key) {}
}

⌨️ 快捷键说明

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