zopiac

Prog

Nov 3rd, 2010
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.73 KB | None | 0 0
  1. package butka;
  2. import java.awt.BorderLayout;
  3. import java.awt.Container;
  4. import java.awt.FlowLayout;
  5. import java.awt.GridLayout;
  6. import java.awt.event.ActionEvent;
  7. import java.awt.event.ActionListener;
  8. import java.awt.event.ItemListener;
  9. import java.awt.event.ItemEvent;
  10. import javax.swing.JButton;
  11. import javax.swing.JFrame;
  12. import javax.swing.JLabel;
  13. import javax.swing.JOptionPane;
  14. import javax.swing.JPanel;
  15. import javax.swing.JRadioButton;
  16. import javax.swing.JTextField;
  17. import javax.swing.JCheckBox;
  18. import javax.swing.text.*;
  19. import javax.swing.ButtonGroup;
  20. public class CharTraits extends JFrame implements ActionListener {
  21.     private Container container;
  22.     private GridLayout advsSectionLayout;
  23.     private GridLayout disadvsSectionLayout;
  24.     private GridLayout traitsSectionLayout;
  25.     private FlowLayout northSectionLayout;
  26.     private JLabel nameInput;
  27.     private JTextField nameField;
  28.     private JLabel raceSelect;
  29.     private JRadioButton human;
  30.     private JRadioButton nephil;
  31.     private JRadioButton slith;
  32.     private ButtonGroup raceRGroup;
  33.     private JPanel northJPanel;
  34.     private JPanel advJPanel;
  35.     private JCheckBox advantages[];
  36.     private JPanel disadvJPanel;
  37.     private JCheckBox disadvantages[];
  38.     private final String disadvNames[] = {"PlaceHolder (%1)", "PlaceHolder (%2)", "PlaceHolder (%3)",
  39.             "PlaceHolder (%4)", "PlaceHolder (%5)"};
  40.     private final String advNames[] = {"Toughness (%10)", "Woodsman (%6)", "Magically Apt. (%20)",
  41.             "Good Constitution (%10)", "Ambidextrous (%8)", "Highly Alert (%7)", "Nimble Fingers (%10)",
  42.             "Exceptional Strength (%12)", "Cave Lore (%4)", "Recuperation (%15)"};
  43.     private JRadioButton races[];
  44.     private final String raceNames[] = {"Human (%0)", "Nephil (%12)", "Slithzerikai (%20)"};
  45.     public CharTraits() {
  46.         super("Pick Stats");
  47.         advsSectionLayout = new GridLayout(5, 2, 2, 8);
  48.         advJPanel = new JPanel();
  49.         advJPanel.setLayout(advsSectionLayout);
  50.         advantages = new JCheckBox[advNames.length];
  51.        
  52.         for (int count = 0; count < advNames.length; ++count) {
  53.             advantages[count] = new JCheckBox(advNames[count]);
  54.             advantages[count].addActionListener(this);
  55.             advJPanel.add(advantages[count]);
  56.         }
  57.        
  58.         disadvsSectionLayout = new GridLayout(5, 1, 0, 8);
  59.         disadvJPanel = new JPanel();
  60.         disadvJPanel.setLayout(disadvsSectionLayout);
  61.         disadvantages = new JCheckBox[disadvNames.length];
  62.         for (int count = 0; count < disadvNames.length; ++count) {
  63.             disadvantages[count] = new JCheckBox(disadvNames[count]);
  64.             disadvantages[count].addActionListener(this);
  65.             disadvJPanel.add(disadvantages[count]);
  66.         }
  67.        
  68.        
  69.         JTextField nameField = new JTextField("", 10);
  70.         JLabel nameInput = new JLabel("Name:");
  71.         JLabel raceSelect = new JLabel("Race:");
  72.         human = new JRadioButton("Human (%0)", true);
  73.         nephil = new JRadioButton("Nephilim (%12)", false);
  74.         slith = new JRadioButton("Slithzerikai (%20)\n", false);
  75.         raceRGroup = new ButtonGroup();
  76.        
  77.         northSectionLayout = new FlowLayout();
  78.         northJPanel = new JPanel();
  79.         northJPanel.setLayout(northSectionLayout);
  80.         northJPanel.add(nameField);
  81.         northJPanel.add(nameInput);
  82.         northJPanel.add(raceSelect);
  83.         races = new JRadioButton[raceNames.length];
  84.         for (int count = 0; count < raceNames.length; ++count) {
  85.             races[count] = new JRadioButton(raceNames[count]);
  86.             races[count].addActionListener(this);
  87.             northJPanel.add(races[count]);
  88.         }
  89.        
  90.         raceRGroup.add(human);
  91.         raceRGroup.add(nephil);
  92.         raceRGroup.add(slith);
  93.  
  94.        
  95. //      northJPanel.add(human);
  96. //      northJPanel.add(nephil);
  97. //      northJPanel.add(slith);
  98.         add(northJPanel, BorderLayout.NORTH);
  99.         add(advJPanel, BorderLayout.CENTER);
  100.         add(disadvJPanel, BorderLayout.SOUTH);
  101.     }
  102.     @Override
  103.     public void actionPerformed(ActionEvent arg0) {
  104.         // TODO Auto-generated method stub
  105.  
  106.     }
  107. }
Add Comment
Please, Sign In to add comment