Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.Container;
- import java.awt.GridLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.BorderFactory;
- import javax.swing.JButton;
- import javax.swing.JCheckBox;
- import javax.swing.JRadioButton;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.Border;
- public class WoW_Character_Gen extends JFrame implements ActionListener
- {
- JButton Submit;
- JButton button = new JButton("Submit");
- JCheckBox Gender, Race, Class, Faction;
- JRadioButton Male, Female;
- Boolean G, R, C, F;
- int Page;
- String title = "What categories do you want to do yourself?";
- public WoW_Character_Gen()
- {
- Container Pane = getContentPane();
- JPanel panel = new JPanel(new GridLayout(0, 1));
- Border border = BorderFactory.createTitledBorder(title);
- panel.setBorder(border);
- button.addActionListener( this );
- button.setActionCommand( "click" );
- Faction = new JCheckBox("Faction");
- Gender = new JCheckBox("Gender");
- Race = new JCheckBox("Race");
- Class = new JCheckBox("Class");
- Male = new JRadioButton("Male");
- Female = new JRadioButton("Female");
- panel.add(Gender);
- panel.add(Race);
- panel.add(Class);
- panel.add(Faction);
- Page=1;
- Pane.add(panel, BorderLayout.CENTER);
- Pane.add(button, BorderLayout.SOUTH);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Pane.setBackground( Color.white );
- }
- public void actionPerformed( ActionEvent evt)
- {
- if(Page == 1){
- if(evt.getActionCommand().equals( "click" )){
- if(Gender.isSelected())
- {
- G = true;
- }
- else
- {
- G = false;
- }
- if(Race.isSelected())
- {
- R = true;
- }
- else
- {
- R = false;
- }
- if(Class.isSelected())
- {
- C = true;
- }
- else
- {
- C = false;
- }
- if(Faction.isSelected())
- {
- F = true;
- }
- else
- {
- F = false;
- }
- System.out.println("Gender = "+G);
- System.out.println("Race = "+R);
- System.out.println("Class = "+C);
- System.out.println("Faction = "+F);
- Page = 2;
- Gender.setVisible(false);
- Race.setVisible(false);
- Class.setVisible(false);
- Faction.setVisible(false);
- repaint();
- }
- }
- if(Page == 2){
- if(G == true){
- title = "What Gender do you want to be?";
- add(Female);
- add(Male);
- revalidate();
- repaint();
- }
- }
- }
- public static void main ( String[] args )
- {
- WoW_Character_Gen frame = new WoW_Character_Gen() ;
- frame.setSize(300, 200);
- frame.setVisible(true);
- frame.setTitle("WoW Character Generator");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment