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

📄 optionlist.java

📁 充气球的j2me代码,可以自由的部署在eclipse,netbeas里面.希望大家喜欢.
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   OptionList.java

import com.nokia.mid.sound.Sound;
import javax.microedition.lcdui.*;

public class OptionList extends List
    implements CommandListener
{

    private TwirlEmUpMIDlet parent;
    private MainMenu menu;
    private Command back;

    public OptionList(String p0, int p1, String p2[], Image p3[], TwirlEmUpMIDlet parent, MainMenu menu)
    {
        super(p0, p1, p2, p3);
        this.parent = null;
        this.menu = null;
        back = new Command("", 2, 2);
        this.menu = menu;
        init(parent);
    }

    public OptionList(String p0, int p1, TwirlEmUpMIDlet parent, MainMenu menu)
    {
        super(p0, p1);
        this.parent = null;
        this.menu = null;
        back = new Command("", 2, 2);
        this.menu = menu;
        init(parent);
    }

    private void init(TwirlEmUpMIDlet parent)
    {
        this.parent = parent;
        addCommand(back);
        setCommandListener(this);
        String soundState = "";
        if(Resources.withSound)
            soundState = "Turn off Sounds";
        else
            soundState = "Turn on Sounds";
        append(soundState, null);
        append("Reset Scores", null);
    }

    public void commandAction(Command p0, Displayable p1)
    {
        Sound settingSound = null;
        if(p0 == back)
        {
            parent.setDisplayable(menu);
        } else
        {
            List lis = (List)p1;
            int idx = lis.getSelectedIndex();
            switch(idx)
            {
            default:
                break;

            case 0: // '\0'
                Resources.withSound = !Resources.withSound;
                Alert soundAlert = new Alert("Sounds");
                soundAlert.setImage(null);
                String soundState = null;
                if(Resources.withSound)
                {
                    try
                    {
                        settingSound = new Sound(Resources.correctSoundByte, 1);
                        settingSound.setGain(200);
                        settingSound.play(1);
                    }
                    catch(Exception e) { }
                    soundState = "Sounds on";
                } else
                {
                    soundState = "Sounds off";
                }
                soundAlert.setString(soundState);
                soundAlert.setTimeout(3000);
                soundAlert.setType(AlertType.CONFIRMATION);
                parent.setDisplayable(soundAlert, menu);
                break;

            case 1: // '\001'
                for(int i = 0; i < 5; i++)
                    Resources.highscore[i] = null;

                Record.delete();
                Alert resetAlert = new Alert("Sounds");
                resetAlert.setImage(null);
                resetAlert.setString("Scores Reset");
                resetAlert.setTimeout(3000);
                resetAlert.setType(AlertType.CONFIRMATION);
                parent.setDisplayable(resetAlert, menu);
                break;
            }
        }
    }
}

⌨️ 快捷键说明

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