Zehdari

Untitled

May 20th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.85 KB | None | 0 0
  1. import java.awt.BorderLayout;
  2. import java.awt.Color;
  3. import java.awt.Container;
  4. import java.awt.GridLayout;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7.  
  8. import javax.swing.BorderFactory;
  9. import javax.swing.JButton;
  10. import javax.swing.JCheckBox;
  11. import javax.swing.JRadioButton;
  12. import javax.swing.JFrame;
  13. import javax.swing.JPanel;
  14. import javax.swing.border.Border;
  15.  
  16. public class WoW_Character_Gen extends JFrame implements ActionListener
  17. {
  18.  
  19.     JButton Submit;
  20.     JButton button = new JButton("Submit");
  21.     JCheckBox Gender, Race, Class, Faction;
  22.     JRadioButton Male, Female;
  23.     Boolean G, R, C, F;
  24.     int Page;
  25.     String title = "What categories do you want to do yourself?";
  26.    
  27.    
  28.    
  29.     public WoW_Character_Gen()
  30.     {
  31.         Container Pane = getContentPane();
  32.         JPanel panel = new JPanel(new GridLayout(0, 1));
  33.         Border border = BorderFactory.createTitledBorder(title);
  34.         panel.setBorder(border);
  35.          
  36.         button.addActionListener( this );
  37.         button.setActionCommand( "click" );
  38.        
  39.         Faction = new JCheckBox("Faction");
  40.         Gender = new JCheckBox("Gender");
  41.         Race = new JCheckBox("Race");
  42.         Class = new JCheckBox("Class");
  43.         Male = new JRadioButton("Male");
  44.         Female = new JRadioButton("Female");
  45.        
  46.        
  47.         panel.add(Gender);
  48.         panel.add(Race);
  49.         panel.add(Class);
  50.         panel.add(Faction);
  51.        
  52.        
  53.         Page=1;
  54.        
  55.  
  56.         Pane.add(panel, BorderLayout.CENTER);
  57.         Pane.add(button, BorderLayout.SOUTH);
  58.        
  59.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  60.         Pane.setBackground( Color.white );
  61.    
  62.    
  63.     }
  64.     public void actionPerformed( ActionEvent evt)
  65.     {
  66.     if(Page == 1){
  67.         if(evt.getActionCommand().equals( "click" )){
  68.            
  69.             if(Gender.isSelected())
  70.             {
  71.                 G = true;
  72.             }
  73.             else
  74.             {
  75.                 G = false;
  76.             }
  77.            
  78.             if(Race.isSelected())
  79.             {
  80.                 R = true;
  81.             }
  82.             else
  83.             {
  84.                 R = false;
  85.             }
  86.            
  87.             if(Class.isSelected())
  88.             {
  89.                 C = true;
  90.             }
  91.             else
  92.             {
  93.                 C = false;
  94.             }
  95.            
  96.             if(Faction.isSelected())
  97.             {
  98.                 F = true;
  99.             }
  100.             else
  101.             {
  102.                 F = false;
  103.             }
  104.  
  105.                
  106.             System.out.println("Gender = "+G);
  107.             System.out.println("Race = "+R);
  108.             System.out.println("Class = "+C);
  109.             System.out.println("Faction = "+F);
  110.             Page = 2;
  111.             Gender.setVisible(false);
  112.             Race.setVisible(false);
  113.             Class.setVisible(false);
  114.             Faction.setVisible(false);
  115.             repaint();
  116.            
  117.            
  118.         }
  119.     }
  120.    
  121.     if(Page == 2){
  122.         if(G == true){
  123.             title = "What Gender do you want to be?";
  124.            
  125.             add(Female);
  126.             add(Male);
  127.             revalidate();
  128.             repaint();
  129.            
  130.            
  131.            
  132.         }
  133.     }
  134.     }
  135.    
  136.     public static void main ( String[] args )
  137.     {
  138.        
  139.         WoW_Character_Gen frame  = new WoW_Character_Gen() ;
  140.         frame.setSize(300, 200);
  141.         frame.setVisible(true);
  142.         frame.setTitle("WoW Character Generator");
  143.  
  144.     }
  145. }
Advertisement
Add Comment
Please, Sign In to add comment