Advertisement
Guest User

appthing

a guest
Jul 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. package Task8;
  2.  
  3. import java.awt.FlowLayout;
  4.  
  5. import javax.swing.*;
  6.  
  7.  
  8. public class PizzaApp extends JFrame
  9.     {
  10.         JTextArea orderSummary;
  11.         JComboBox<String> pizzaType;
  12.         JSlider pizzaSize;
  13.         JCheckBox addCheese, addOlives, addPeppers, addPepperoni;
  14.         JTextField comment;
  15.         JButton submitOrder;
  16.         JPanel leftPanel, rightPanel, toppingsPanel;
  17.        
  18.         public PizzaApp(String title)
  19.         {
  20.             super(title);
  21.             createElements();
  22.             setLayouts();
  23.            
  24.         }
  25.        
  26.     private void createElements()
  27.     {
  28.         orderSummary = new JTextArea();
  29.         pizzaType = new JComboBox<>();
  30.         pizzaSize = new JSlider();
  31.         addCheese = new JCheckBox("Add Cheese?");
  32.         addOlives = new JCheckBox("Add Olives?");
  33.         addPeppers = new JCheckBox("Add Peppers?");
  34.         addPepperoni = new JCheckBox("Add Pepperoni?");
  35.         comment = new JTextField();
  36.         submitOrder = new JButton("Submit Order");
  37.         leftPanel = new JPanel();
  38.         rightPanel = new JPanel();
  39.         toppingsPanel = new JPanel();
  40.     }
  41.     private void setLayouts()
  42.     {
  43.         setLayout(new FlowLayout());
  44.         leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));
  45.         rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
  46.         toppingsPanel.setLayout(new BoxLayout(toppingsPanel, BoxLayout.X_AXIS));
  47.     }
  48.     public static void main(String[] args)
  49.     {
  50.         PizzaApp app = new PizzaApp("Pizza App");
  51.         app.setVisible(true);
  52.         app.setDefaultCloseOperation(EXIT_ON_CLOSE);
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement