// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   ScrambleSetup.java

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ScrambleSetup extends Dialog
    implements ActionListener
{

    ScrambleSetup(Scramble scramble, String as[])
    {
        super(scramble, "Scramble Setup Options", true);
        rows = 8;
        choices = new String[6];
        mainps = (new Panel[] {
            new Panel(new GridLayout(rows, 1, 0, 0)), new Panel(new GridLayout(rows, 1, 0, 0)), new Panel(new GridLayout(rows, 1, 0, 0)), new Panel(new GridLayout(rows, 1, 0, 0)), new Panel(new GridLayout(rows, 1, 0, 0)), new Panel(new GridLayout(rows, 1, 0, 0))
        });
        playerL = new Label("Starting Player");
        startSquareL = new Label("Starting Square");
        bonusSquaresL = new Label("Bonus Square");
        timerL = new Label("Timer");
        tilesL = new Label("Tiles");
        tileValuesL = new Label("Tile Values");
        labels = (new Label[] {
            playerL, startSquareL, bonusSquaresL, timerL, tilesL, tileValuesL
        });
        playerCbg = new CheckboxGroup();
        startSquareCbg = new CheckboxGroup();
        bonusSquaresCbg = new CheckboxGroup();
        timerCbg = new CheckboxGroup();
        tilesCbg = new CheckboxGroup();
        tileValuesCbg = new CheckboxGroup();
        Cbgs = (new CheckboxGroup[] {
            playerCbg, startSquareCbg, bonusSquaresCbg, timerCbg, tilesCbg, tileValuesCbg
        });
        back = new Panel();
        done = new Button("Done");
        checkBoxes = (new Checkbox[][] {
            new Checkbox[] {
                new Checkbox("Player 1", false, playerCbg), new Checkbox("Random", false, playerCbg)
            }, new Checkbox[] {
                new Checkbox("Standard", false, startSquareCbg), new Checkbox("Random", false, startSquareCbg), new Checkbox("None", false, startSquareCbg)
            }, new Checkbox[] {
                new Checkbox("Standard", false, bonusSquaresCbg), new Checkbox("Random", false, bonusSquaresCbg), new Checkbox("None", false, bonusSquaresCbg)
            }, new Checkbox[] {
                new Checkbox("None", false, timerCbg), new Checkbox("Set for each player", false, timerCbg), new Checkbox("Change each round", false, timerCbg)
            }, new Checkbox[] {
                new Checkbox("Standard", false, tilesCbg), new Checkbox("Random Set", false, tilesCbg)
            }, new Checkbox[] {
                new Checkbox("Standard", false, tileValuesCbg), new Checkbox("Random", false, tileValuesCbg), new Checkbox("Adjust for frequency", false, tileValuesCbg), new Checkbox("All set to 1", false, tileValuesCbg)
            }
        });
        setBackground(new Color(160, 160, 100));
        myFrame = scramble;
        setBounds(new Rectangle(scramble.getLocationOnScreen(), scramble.getSize()));
        for(int i = 0; i < 6; i++)
        {
            labels[i].setFont(new Font("Dialog", 1, 16));
            labels[i].setForeground(new Color(0, 80, 10));
            mainps[i].add(blanks[i]);
            mainps[i].add(labels[i]);
            for(int j = 0; j < checkBoxes[i].length; j++)
                mainps[i].add(checkBoxes[i][j]);

            add(mainps[i]);
        }

        for(int k = 0; k < 6; k++)
        {
            for(int l = 0; l < checkBoxes[k].length; l++)
                if(checkBoxes[k][l].getLabel().equals(as[k]))
                    Cbgs[k].setSelectedCheckbox(checkBoxes[k][l]);

        }

        mainps[0].setBounds(20, 29, 206, 204);
        mainps[1].setBounds(229, 29, 206, 204);
        mainps[2].setBounds(438, 29, 206, 204);
        mainps[3].setBounds(20, 235, 206, 204);
        mainps[4].setBounds(229, 235, 206, 204);
        mainps[5].setBounds(438, 235, 206, 204);
        done.setBounds(290, 444, 60, 30);
        add(done);
        add(back);
        done.addActionListener(this);
        setVisible(true);
    }

    String[] getChoices()
    {
        return choices;
    }

    public void actionPerformed(ActionEvent actionevent)
    {
        String s = actionevent.getActionCommand();
        if("Done".equals(s))
        {
            choices[0] = playerCbg.getSelectedCheckbox().getLabel();
            choices[1] = startSquareCbg.getSelectedCheckbox().getLabel();
            choices[2] = bonusSquaresCbg.getSelectedCheckbox().getLabel();
            choices[3] = timerCbg.getSelectedCheckbox().getLabel();
            choices[4] = tilesCbg.getSelectedCheckbox().getLabel();
            choices[5] = tileValuesCbg.getSelectedCheckbox().getLabel();
            dispose();
        }
    }

    int rows;
    Scramble myFrame;
    String choices[];
    Panel mainps[];
    Label playerL;
    Label startSquareL;
    Label bonusSquaresL;
    Label timerL;
    Label tilesL;
    Label tileValuesL;
    Label labels[];
    CheckboxGroup playerCbg;
    CheckboxGroup startSquareCbg;
    CheckboxGroup bonusSquaresCbg;
    CheckboxGroup timerCbg;
    CheckboxGroup tilesCbg;
    CheckboxGroup tileValuesCbg;
    CheckboxGroup Cbgs[];
    Panel blanks[] = {
        new Panel(), new Panel(), new Panel(), new Panel(), new Panel(), new Panel()
    };
    Panel back;
    Button done;
    Checkbox checkBoxes[][];
}
