Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package butka;
- import java.awt.BorderLayout;
- import java.awt.Container;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.ItemListener;
- import java.awt.event.ItemEvent;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JOptionPane;
- import javax.swing.JPanel;
- import javax.swing.JRadioButton;
- import javax.swing.JTextField;
- import javax.swing.JCheckBox;
- import javax.swing.text.*;
- import javax.swing.ButtonGroup;
- public class CharTraits extends JFrame implements ActionListener {
- private Container container;
- private GridLayout advsSectionLayout;
- private GridLayout disadvsSectionLayout;
- private GridLayout traitsSectionLayout;
- private FlowLayout northSectionLayout;
- private JLabel nameInput;
- private JTextField nameField;
- private JLabel raceSelect;
- private JRadioButton human;
- private JRadioButton nephil;
- private JRadioButton slith;
- private ButtonGroup raceRGroup;
- private JPanel northJPanel;
- private JPanel advJPanel;
- private JCheckBox advantages[];
- private JPanel disadvJPanel;
- private JCheckBox disadvantages[];
- private final String disadvNames[] = {"PlaceHolder (%1)", "PlaceHolder (%2)", "PlaceHolder (%3)",
- "PlaceHolder (%4)", "PlaceHolder (%5)"};
- private final String advNames[] = {"Toughness (%10)", "Woodsman (%6)", "Magically Apt. (%20)",
- "Good Constitution (%10)", "Ambidextrous (%8)", "Highly Alert (%7)", "Nimble Fingers (%10)",
- "Exceptional Strength (%12)", "Cave Lore (%4)", "Recuperation (%15)"};
- private JRadioButton races[];
- private final String raceNames[] = {"Human (%0)", "Nephil (%12)", "Slithzerikai (%20)"};
- public CharTraits() {
- super("Pick Stats");
- advsSectionLayout = new GridLayout(5, 2, 2, 8);
- advJPanel = new JPanel();
- advJPanel.setLayout(advsSectionLayout);
- advantages = new JCheckBox[advNames.length];
- for (int count = 0; count < advNames.length; ++count) {
- advantages[count] = new JCheckBox(advNames[count]);
- advantages[count].addActionListener(this);
- advJPanel.add(advantages[count]);
- }
- disadvsSectionLayout = new GridLayout(5, 1, 0, 8);
- disadvJPanel = new JPanel();
- disadvJPanel.setLayout(disadvsSectionLayout);
- disadvantages = new JCheckBox[disadvNames.length];
- for (int count = 0; count < disadvNames.length; ++count) {
- disadvantages[count] = new JCheckBox(disadvNames[count]);
- disadvantages[count].addActionListener(this);
- disadvJPanel.add(disadvantages[count]);
- }
- JTextField nameField = new JTextField("", 10);
- JLabel nameInput = new JLabel("Name:");
- JLabel raceSelect = new JLabel("Race:");
- human = new JRadioButton("Human (%0)", true);
- nephil = new JRadioButton("Nephilim (%12)", false);
- slith = new JRadioButton("Slithzerikai (%20)\n", false);
- raceRGroup = new ButtonGroup();
- northSectionLayout = new FlowLayout();
- northJPanel = new JPanel();
- northJPanel.setLayout(northSectionLayout);
- northJPanel.add(nameField);
- northJPanel.add(nameInput);
- northJPanel.add(raceSelect);
- races = new JRadioButton[raceNames.length];
- for (int count = 0; count < raceNames.length; ++count) {
- races[count] = new JRadioButton(raceNames[count]);
- races[count].addActionListener(this);
- northJPanel.add(races[count]);
- }
- raceRGroup.add(human);
- raceRGroup.add(nephil);
- raceRGroup.add(slith);
- // northJPanel.add(human);
- // northJPanel.add(nephil);
- // northJPanel.add(slith);
- add(northJPanel, BorderLayout.NORTH);
- add(advJPanel, BorderLayout.CENTER);
- add(disadvJPanel, BorderLayout.SOUTH);
- }
- @Override
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- }
- }
Add Comment
Please, Sign In to add comment