Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Task8;
- import java.awt.FlowLayout;
- import javax.swing.*;
- public class PizzaApp extends JFrame
- {
- JTextArea orderSummary;
- JComboBox<String> pizzaType;
- JSlider pizzaSize;
- JCheckBox addCheese, addOlives, addPeppers, addPepperoni;
- JTextField comment;
- JButton submitOrder;
- JPanel leftPanel, rightPanel, toppingsPanel;
- public PizzaApp(String title)
- {
- super(title);
- createElements();
- setLayouts();
- }
- private void createElements()
- {
- orderSummary = new JTextArea();
- pizzaType = new JComboBox<>();
- pizzaSize = new JSlider();
- addCheese = new JCheckBox("Add Cheese?");
- addOlives = new JCheckBox("Add Olives?");
- addPeppers = new JCheckBox("Add Peppers?");
- addPepperoni = new JCheckBox("Add Pepperoni?");
- comment = new JTextField();
- submitOrder = new JButton("Submit Order");
- leftPanel = new JPanel();
- rightPanel = new JPanel();
- toppingsPanel = new JPanel();
- }
- private void setLayouts()
- {
- setLayout(new FlowLayout());
- leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));
- rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
- toppingsPanel.setLayout(new BoxLayout(toppingsPanel, BoxLayout.X_AXIS));
- }
- public static void main(String[] args)
- {
- PizzaApp app = new PizzaApp("Pizza App");
- app.setVisible(true);
- app.setDefaultCloseOperation(EXIT_ON_CLOSE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement