sicotic87

DESKCENTERGUI

Dec 4th, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.27 KB | None | 0 0
  1. package deskcenter;
  2.  
  3. import javax.swing.*;
  4. import java.awt.*;
  5.  
  6.  
  7. public class WelcomeScreen extends JFrame{
  8.        
  9.         private JPanel panel;
  10.         private JPanel panel2;
  11.         private JPanel panel3;
  12.         private JPanel panel4;
  13.         private JPanel panel5;
  14.         private JLabel label;
  15.         private JButton button;
  16.         private JButton button2;
  17.         private JButton button3;
  18.         private JButton button4;
  19.        
  20.         private final int WIDTH = 300;
  21.         private final int LENGTH = 400;
  22.        
  23.         public WelcomeScreen() {
  24.            
  25.             this.setLayout(new FlowLayout());
  26.            
  27.             this.setTitle("Welcome");
  28.            
  29.             Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
  30.            
  31.             this.setSize(WIDTH, LENGTH);
  32.             this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  33.             this.setLocationRelativeTo(null);
  34.  
  35.             panel = new JPanel();
  36.            
  37.             this.label = new JLabel("Please choose an option below.");
  38.             //this.button = new JButton("Trapezoid");
  39.             //this.button2 = new JButton("Sphere");
  40.             //this.button3 = new JButton("Parallelogram");
  41.             //this.button4 = new JButton("Rectangle");
  42.            
  43.             panel.add(this.label);
  44.             //panel.add(this.button);
  45.             //panel.add(this.button2);
  46.             //panel.add(this.button3);
  47.             //panel.add(this.button4);
  48.            
  49.             this.add(panel);
  50.            
  51.             panel2 = new JPanel();
  52.            
  53.             this.button = new JButton("Trapezoid");
  54.            
  55.             panel2.add(this.button);
  56.            
  57.             this.add(panel2);
  58.            
  59.             panel3 = new JPanel();
  60.            
  61.             this.button2 = new JButton("Square");
  62.            
  63.             panel3.add(this.button2);
  64.            
  65.             this.add(panel3);
  66.            
  67.             panel4 = new JPanel();
  68.            
  69.             this.button3 = new JButton("Parallelogram");
  70.            
  71.             panel4.add(this.button3);
  72.            
  73.             this.add(panel4);
  74.            
  75.             this.setVisible(true);
  76.            
  77.             panel5 = new JPanel();
  78.            
  79.             this.button4 = new JButton("Rectangle");
  80.            
  81.             panel5.add(this.button4);
  82.            
  83.             this.add(panel5);
  84.  
  85.            
  86.         }
  87.        
  88.         //ADD AN ACTION LISTENER FOR EACH BUTTON THAT WOULD BRING UP A NEW GUI ASKING THEM TO SELECT A MATHEMATICAL OPERATION TO PERFORM
  89.        
  90.    
  91. }
Advertisement
Add Comment
Please, Sign In to add comment