PizzaOrderPanel -...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //******************************************************************** // PizzaOrderPanel.java Authors: Lewis and Loftus // // Solution to Programming Project 9.11 // //******************************************************************** import java.util.*; import java.awt.event.*; import java.awt.*; import javax.swing.*; import javax.swing.border.*; import java.text.NumberFormat; public class PizzaOrderPanel extends JPanel { ArrayList pizzaOrder; ButtonGroup sizeGroup; ButtonGroup crustGroup; ButtonGroup sauceGroup; JCheckBox cheeseCheckBoxes; JCheckBox meatToppingCheckBoxes; JCheckBox veggieToppingCheckBoxes; JLabel numPizzasLabel; JLabel totalPriceLabel; float previousPrice; PizzaOrderPortal portal; //----------------------------------------------------------------- // Set up the pizza ordering GUI //----------------------------------------------------------------- public PizzaOrderPanel(PizzaOrderPortal orderPortal) { portal = orderPortal; previousPrice = 0.0f; pizzaOrder = new ArrayList(); setLayout(new BorderLayout()); add(createSizePanel(), BorderLayout.NORTH); add(createPizzaPanel(),BorderLayout.CENTER); add(createOrderButtonPanel(), BorderLayout.SOUTH); } //----------------------------------------------------------------- // Creates the pizza size panel //----------------------------------------------------------------- JPanel createSizePanel() { sizeGroup = new ButtonGroup(); JPanel sizePanel = new JPanel(); sizePanel.setBorder(new EtchedBorder()); sizePanel.add(new JLabel("Size: ")); // add sizes from class Pizza JRadioButton rButton; for (int i = 0; i < Pizza.SIZES.length; i++) { rButton = new JRadioButton(Pizza.SIZES[i]); rButton.setActionCommand(String.valueOf(i)); sizeGroup.add(rButton); sizePanel.add(rButton); if (i==0) rButton.setSelected(true); } return sizePanel; } //----------------------------------------------------------------- // Creates the upper panel in the main pizza panel //----------------------------------------------------------------- JPanel createUpperPanel() { JPanel upperPanel = new JPanel(); JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS)); // set up crust choices crustGroup = new ButtonGroup(); JPanel crustPanel = new JPanel(); crustPanel.setLayout(new BoxLayout(crustPanel, BoxLayout.Y_AXIS)); crustPanel.setBorder(new TitledBorder(new EtchedBorder(), "Crust")); // add crust types from class Pizza JRadioButton rButton; for (int i = 0; i < Pizza.CRUST_TYPES.length; i++)for (int i = 0; i < Pizza....
View Full Document

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 6

PizzaOrderPanel -...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online