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

📄 setupdialog.java

📁 一个已经实现的连连看小游戏的源码
💻 JAVA
字号:
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SetupDialog.java

package kyodai.topbar;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.border.Border;
import kyodai.Setting;

public class SetupDialog extends JDialog
{

    public SetupDialog(JFrame frame)
    {
        super(frame, true);
        PanelClose = new JPanel();
        Close = new JButton();
        PanelCenter = new JPanel();
        gridLayout1 = new GridLayout();
        PanelMusic = new JPanel();
        PanelEffect = new JPanel();
        PanelLevel = new JPanel();
        PanelAnimate = new JPanel();
        MusicOn = new JRadioButton();
        MusicOff = new JRadioButton();
        Music = new JLabel();
        PanelLeft = new JPanel();
        PanelRight = new JPanel();
        Effect = new JLabel();
        EffectOn = new JRadioButton();
        EffectOff = new JRadioButton();
        Level = new JLabel();
        Level1 = new JRadioButton();
        Level2 = new JRadioButton();
        Level3 = new JRadioButton();
        Level4 = new JRadioButton();
        Level5 = new JRadioButton();
        flowLayout1 = new FlowLayout();
        flowLayout2 = new FlowLayout();
        flowLayout3 = new FlowLayout();
        AnimateSpeed = new JLabel();
        flowLayout4 = new FlowLayout();
        Speed1 = new JRadioButton();
        Speed8 = new JRadioButton();
        Speed2 = new JRadioButton();
        Speed4 = new JRadioButton();
        PanelTop = new JPanel();
        MusicGroup = new ButtonGroup();
        EffectGroup = new ButtonGroup();
        LevelGroup = new ButtonGroup();
        SpeedGroup = new ButtonGroup();
        try
        {
            jbInit();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setLocation((screenSize.width - 400) / 2, (screenSize.height - 320) / 2);
        setResizable(false);
    }

    private void jbInit()
        throws Exception
    {
        border2 = BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.lightGray, 1), BorderFactory.createEmptyBorder(2, 10, 2, 10));
        setSize(new Dimension(400, 320));
        setTitle("Setup");
        border1 = BorderFactory.createEmptyBorder();
        PanelClose.setBackground(Color.white);
        Close.setBackground(Color.white);
        Close.setBorder(border2);
        Close.setText("Close");
        Close.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e)
            {
                if(MusicOn.isSelected())
                    Setting.Music = 1;
                else
                    Setting.Music = 0;
                if(EffectOn.isSelected())
                    Setting.Sound = 1;
                else
                    Setting.Sound = 0;
                if(Level1.isSelected())
                    Setting.LevelIndex = 0;
                if(Level2.isSelected())
                    Setting.LevelIndex = 1;
                if(Level3.isSelected())
                    Setting.LevelIndex = 2;
                if(Level4.isSelected())
                    Setting.LevelIndex = 3;
                if(Level5.isSelected())
                    Setting.LevelIndex = 4;
                if(Speed1.isSelected())
                    Setting.Animate = 1;
                if(Speed2.isSelected())
                    Setting.Animate = 2;
                if(Speed4.isSelected())
                    Setting.Animate = 4;
                if(Speed8.isSelected())
                    Setting.Animate = 8;
                dispose();
            }

        });
        PanelCenter.setBackground(Color.white);
        PanelCenter.setLayout(gridLayout1);
        gridLayout1.setColumns(1);
        gridLayout1.setRows(6);
        PanelMusic.setBackground(Color.white);
        PanelMusic.setLayout(flowLayout3);
        PanelEffect.setBackground(Color.white);
        PanelEffect.setLayout(flowLayout2);
        PanelLevel.setBackground(Color.white);
        PanelLevel.setLayout(flowLayout1);
        PanelAnimate.setBackground(Color.white);
        PanelAnimate.setLayout(flowLayout4);
        MusicOn.setBackground(Color.white);
        MusicOn.setSelected(true);
        MusicOn.setText("ON(Default)");
        MusicOff.setBackground(Color.white);
        MusicOff.setText("Off");
        Music.setText("Music");
        PanelLeft.setBackground(Color.white);
        PanelLeft.setMinimumSize(new Dimension(30, 10));
        PanelLeft.setOpaque(true);
        PanelLeft.setPreferredSize(new Dimension(30, 10));
        PanelRight.setBackground(Color.white);
        PanelRight.setFont(new Font("Dialog", 0, 11));
        PanelRight.setMinimumSize(new Dimension(30, 10));
        PanelRight.setPreferredSize(new Dimension(30, 10));
        Effect.setText("Effect");
        EffectOn.setBackground(Color.white);
        EffectOn.setSelected(true);
        EffectOn.setText("On(Default)");
        EffectOff.setBackground(Color.white);
        EffectOff.setText("Off");
        Level.setText("Level");
        Level1.setBackground(Color.white);
        Level1.setText("1");
        Level2.setBackground(Color.white);
        Level2.setText("2");
        Level3.setBackground(Color.white);
        Level3.setSelected(true);
        Level3.setText("3(Normal)");
        Level4.setBackground(Color.white);
        Level4.setText("4");
        Level5.setBackground(Color.white);
        Level5.setText("5");
        flowLayout1.setAlignment(0);
        flowLayout2.setAlignment(0);
        flowLayout3.setAlignment(0);
        AnimateSpeed.setText("AnimateSpeed");
        flowLayout4.setAlignment(0);
        Speed1.setBackground(Color.white);
        Speed1.setText("1x");
        Speed8.setBackground(Color.white);
        Speed8.setText("8x");
        Speed2.setBackground(Color.white);
        Speed2.setSelected(true);
        Speed2.setText("2x(Default)");
        Speed4.setBackground(Color.white);
        Speed4.setText("4x");
        PanelTop.setBackground(Color.white);
        PanelTop.setMinimumSize(new Dimension(10, 10));
        getContentPane().add(PanelClose, "South");
        PanelClose.add(Close, null);
        getContentPane().add(PanelCenter, "Center");
        PanelMusic.add(Music, null);
        PanelMusic.add(MusicOn, null);
        PanelMusic.add(MusicOff, null);
        PanelCenter.add(PanelTop, null);
        PanelCenter.add(PanelMusic, null);
        PanelCenter.add(PanelEffect, null);
        PanelCenter.add(PanelLevel, null);
        PanelCenter.add(PanelAnimate, null);
        PanelAnimate.add(AnimateSpeed, null);
        PanelAnimate.add(Speed1, null);
        PanelAnimate.add(Speed2, null);
        PanelAnimate.add(Speed4, null);
        PanelAnimate.add(Speed8, null);
        getContentPane().add(PanelLeft, "West");
        getContentPane().add(PanelRight, "East");
        PanelEffect.add(Effect, null);
        PanelEffect.add(EffectOn, null);
        PanelEffect.add(EffectOff, null);
        PanelLevel.add(Level, null);
        PanelLevel.add(Level1, null);
        PanelLevel.add(Level2, null);
        PanelLevel.add(Level3, null);
        PanelLevel.add(Level4, null);
        PanelLevel.add(Level5, null);
        SpeedGroup.add(Speed1);
        SpeedGroup.add(Speed2);
        SpeedGroup.add(Speed4);
        SpeedGroup.add(Speed8);
        EffectGroup.add(EffectOn);
        EffectGroup.add(EffectOff);
        LevelGroup.add(Level1);
        LevelGroup.add(Level2);
        LevelGroup.add(Level3);
        LevelGroup.add(Level4);
        LevelGroup.add(Level5);
        MusicGroup.add(MusicOn);
        MusicGroup.add(MusicOff);
        load();
    }

    private void load()
    {
        if(Setting.Music == 1)
            MusicOn.setSelected(true);
        else
            MusicOff.setSelected(true);
        if(Setting.Sound == 1)
            EffectOn.setSelected(true);
        else
            EffectOff.setSelected(true);
        if(Setting.LevelIndex == 0)
            Level1.setSelected(true);
        else
        if(Setting.LevelIndex == 1)
            Level2.setSelected(true);
        else
        if(Setting.LevelIndex == 3)
            Level4.setSelected(true);
        else
        if(Setting.LevelIndex == 4)
            Level5.setSelected(true);
        else
            Level3.setSelected(true);
        if(Setting.Animate == 1)
            Speed1.setSelected(true);
        else
        if(Setting.Animate == 4)
            Speed4.setSelected(true);
        else
        if(Setting.Animate == 8)
            Speed8.setSelected(true);
        else
            Speed2.setSelected(true);
    }

    Border border1;
    JPanel PanelClose;
    JButton Close;
    Border border2;
    JPanel PanelCenter;
    GridLayout gridLayout1;
    JPanel PanelMusic;
    JPanel PanelEffect;
    JPanel PanelLevel;
    JPanel PanelAnimate;
    JRadioButton MusicOn;
    JRadioButton MusicOff;
    JLabel Music;
    JPanel PanelLeft;
    JPanel PanelRight;
    JLabel Effect;
    JRadioButton EffectOn;
    JRadioButton EffectOff;
    JLabel Level;
    JRadioButton Level1;
    JRadioButton Level2;
    JRadioButton Level3;
    JRadioButton Level4;
    JRadioButton Level5;
    FlowLayout flowLayout1;
    FlowLayout flowLayout2;
    FlowLayout flowLayout3;
    JLabel AnimateSpeed;
    FlowLayout flowLayout4;
    JRadioButton Speed1;
    JRadioButton Speed8;
    JRadioButton Speed2;
    JRadioButton Speed4;
    JPanel PanelTop;
    ButtonGroup MusicGroup;
    ButtonGroup EffectGroup;
    ButtonGroup LevelGroup;
    ButtonGroup SpeedGroup;
}

⌨️ 快捷键说明

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