Tabs Tab 1 Component Panel 1 example essay topic
' ); JPanel panel 2 = new JPanel ; burger 1 = new JButton ('Hamburger'); burger 1. addActionListener (this); burger 2 = new JButton ('Double Hamburger'); burger 2. addActionListener (this); burger 3 = new JButton ('Veg i-Burger'); burger 3. addActionListener (this); panel 2. add (note); panel 2. add (burger 1); panel 2. add (burger 2); panel 2. add (burger 3); panel 2. setLayout (new Box Layout (panel 2, Box Layout. PAGE AXIS) ); return panel 2; }; //Tab 3 public Component make Panel 3 { JPanel panel 3 = new JPanel ; next = new JButton ('update'); next. addActionListener (this); //JCheckBox that can be listened to by Item Listener cheese = new JCheckBox ('Cheese'); ketchup = new JCheckBox ('Ketchup'); onions = new JCheckBox ('Onions'); pickles = new JCheckBox ('Pickles'); mustard = new JCheckBox ('Mustard'); lettuce = new JCheckBox ('Lettuce'); tomato's = new JCheckBox ('Tomatos'); cheese. addItemListener (this); ketchup. addItemListener (this); onions. addItemListener (this); pickles. addItemListener (this); mustard. addItemListener (this); lettuce. addItemListener (this); tomato's. addItemListener (this); panel 3. add (cheese); panel 3. add (ketchup); panel 3. add (onions); panel 3. add (pickles); panel 3. add (mustard); panel 3. add (lettuce); panel 3. add (tomato's); panel 3. add (next); panel 3. setLayout (new Box Layout (panel 3, Box Layout. PAGE AXIS) ); //Method Condiment Test, runs method to verify which Check boxes are checked for each order, //Data inside checks ; return panel 3; }; //Tab 4 public Component make Panel 4 { JPanel panel 4 = new JPanel ; coke = new JButton ('Coke'); coke. addActionListener (this); sprite = new JButton ('Sprite'); sprite. addActionListener (this); drp = new JButton ('Dr. Pepper'); drp. addActionListener (this); root = new JButton ('Root Beer'); root. addActionListener (this); orange = new JButton ('Orange Soda'); orange. addActionListener (this); panel 4. add (coke); panel 4. add (sprite); panel 4. add (drp); panel 4. add (root); panel 4. add (orange); panel 4. setLayout (new Box Layout (panel 4, Box Layout. PAGE AXIS) ); return panel 4; }; //Tab 5, public Component make Panel 5 { JPanel panel 5 = new JPanel ; ultra = new JButton ('Ultra (c) Size. +$0.39'); ultra. addActionListener (this); large = new JButton ('Large Size, +$0.29'); large. addActionListener (this); medium = new JButton ('Medium Size'); medium. addActionListener (this); small = new JButton ('Small Size, -$0.28'); small. addActionListener (this); panel 5. add (ultra); panel 5. add (large); panel 5. add (medium); panel 5. add (small); panel 5. setLayout (new Box Layout (panel 5, Box Layout. PAGE AXIS) ); return panel 5; }; //Tab 6 public Component make Panel 6 { JPanel panel 6 = new JPanel ; order = new JTextArea ; order. setBorder (BorderFactory. createEmptyBorder (5, 5, 5, 5) ); add order = new JButton ('Add Another Combo'); add order. addActionListener (this); pay now = new JButton ('Pay Now'); pay now. addActionListener (this); panel 6. add (order); panel 6. add (add order); panel 6. add (pay now); panel 6. setLayout (new Box Layout (panel 6, Box Layout.
PAGE AXIS) ); return panel 6; }; //Tab 7 public Component make Panel 7 { t orders = new JTextArea ; t orders. setText (total order); t orders. setBorder (BorderFactory. createEmptyBorder (5, 5, 5, 5) ); JPanel panel 7 l = new JPanel ; added it = new JButton ('Add / Edit Order'); remove ord = new JButton ('Remove Order'); added it. addActionListener (this); remove ord. addActionListener (this); cc pay = new JButton ('Credit Card'); cc pay. addActionListener (this); ca pay = new JButton ('Cash'); ca pay. addActionListener (this); panel 7 l. add (added it); panel 7 l. add (remove ord); panel 7 l. add (Box. createRigidArea (new Dimension (0,200) ) ); panel 7 l. add (cc pay); panel 7 l. add (ca pay); JScrollPane panel 7 r = new JScrollPane (t orders); JSplitPane panel 7 = new JSplitPane (JSplitPane. HORIZONTAL SPLIT, panel 7 l, panel 7 r); panel 7. setDividerLocation (120); panel 7. setDividerSize (0); return panel 7; }; //Tab 8, Has two different ways of building depending on information from the Action listener's// Code. The building takes place after the Cash or credit button is pressed. I then builds accordingly. public Component make Panel 8 { //Possible objects, added depending on PType, The pay selection amt due = new JTextField ; amt due. setText (' Amount due: '+ tt price+' '); visa = new JButton ('Visa'); visa. addActionListener (this); mc = new JButton ('Master Card'); mc. addActionListener (this); a mex = new JButton ('American Express'); a mex. addActionListener (this); atm = new JButton ('ATM Debit Card'); atm. addActionListener (this); back = new JButton ('Back'); back. addActionListener (this); receipt = new JTextArea ; receipt. setBorder (BorderFactory. createEmptyBorder (5, 5, 5, 5) ); panel 8 bb = new JPanel ; panel 8 bt = new JPanel ; panel 8 bt a = new JScrollPane (receipt); //Builds for credit cards, if (p type = = 1) { receipt. setText ('Order # '++'nn'+total order); //add buttons for major credit cards. Add Receipt and amount due panel 8 t = new JPanel ; panel 8 t. add (amt due); panel 8 t. add (visa); panel 8 t. add (mc); panel 8 t. add (a mex); panel 8 t. add (atm); panel 8 t. add (back); panel 8 bt. add (panel 8 bt a); bye = new JTextArea ; bye. setBorder (BorderFactory. createEmptyBorder (5, 5, 5, 5) ); bye. setText ('Thank You for eating at Mc Dowels. n'+ 'Please remember to take your receipt below, and wait for your number to be called... '); //Take receipt and return to start screen for new order. take = new JButton ('Take Receipt'); take. addActionListener (this); } //Builds for cash. else if (p type = = 2) { //Add Insert Cash, Receipt, and take receipt buttons. panel 8 t = new JPanel ; panel 8 t. add (amt due); insert = new JButton ('Insert Bill'); insert. addActionListener (this); panel 8 t. add (insert); panel 8 t. add (back); receipt. setText ('Order # '++'nn'+total order); panel 8 bt. add (panel 8 bt a); bye = new JTextArea ; bye. setBorder (BorderFactory. createEmptyBorder (5, 5, 5, 5) ); bye. setText ('Thank You for eating at Mc Dowels. n'+ 'Please remember to take your receipt below, and wait for your number to be called... '); take = new JButton ('Take Receipt'); take. addActionListener (this); }; //Set layout of this panel panel 8 bb. setLayout (new Box Layout (panel 8 bb, Box Layout.
PAGE AXIS) ); //Jsplitpane the two panels JSplitPane panel 8 b = new JSplitPane (JSplitPane. VERTICAL SPLIT, panel 8 bt a, panel 8 bb); panel 8 b. setDividerLocation (300); panel 8 b. setDividerSize (0); //Another JSplitPane, to make 3 panels in one windowJSplitPane panel 8 = new JSplitPane (JSplitPane. VERTICAL SPLIT, panel 8 t, panel 8 b); //Divider Locations in pixels panel 8. setDividerLocation (65); panel 8. setDividerSize (0); return panel 8; }; //Method to clear all the variables and objects. public void reset { c = (-1); bill a = 0; bill = 0; l = -1; t = -1; k = -1; m = -1; o = -1; p = -1; burg 1 = '; burg 2 = '; burg 3 = '; lett = '; to ma = '; k etc = '; must = '; on = '; pick = '; che = '; orders = '; ultra d = '; large = '; medium d = '; small = '; sprite d = '; drp d = '; root = '; orange = '; coked = '; order num = 1; p type = 0; ord 1 = '; ord 2 = '; ord 3 = '; o 1 p = 0; o 2 p = 0; o 3 p = 0; //Reset all the checks in condiments checks [0] [0] = 0; checks [0] [1] = 0; checks [0] [2] = 0; checks [0] [3] = 0; checks [0] [4] = 0; checks [0] [5] = 0; checks [0] [6] = 0; checks [1] [0] = 0; checks [1] [1] = 0; checks [1] [2] = 0; checks [1] [3] = 0; checks [1] [4] = 0; checks [1] [5] = 0; checks [1] [6] = 0; checks [2] [0] = 0; checks [2] [1] = 0; checks [2] [2] = 0; checks [2] [3] = 0; checks [2] [4] = 0; checks [2] [5] = 0; checks [2] [6] = 0; total order = '; tt price = '; = +1; rem tab (7); //Reset to the main screen by disabling. tabbed Pane. setEnabledAt (6, false); tabbed Pane. setEnabledAt (5, false); tabbed Pane. setEnabledAt (4, false); tabbed Pane. setEnabledAt (3, false); tabbed Pane. setEnabledAt (2, false); tabbed Pane. setEnabledAt (1, false); tabbed Pane. setEnabledAt (0, true); sets el (0); } //Method for the sets el call above, Moves to indicated tab. public void sets el (int num) {tabbed Pane. setSelectedIndex (num); }; //This method sets the limit on orders ordered at the ATM. public void {if (order num = = 3) {add order. setVisible (false); }else if (order num = = 2) {add order. setVisible (true); }else if (order num = = 1) {add order. setVisible (true); }else if (order num = 4) {add order. setVisible (false); }; }//Reads the checks array and selects the condiment's check boxes according to checks's data. public void { //Buried If else if statements to allow for different order number and combos. //Order number 4 corresponds to order number 1, This is done because the user needs to edit an order //however, The add order button if the order is 3 or greater, hence 4-6 is 1-3 in reality. if (order num = = 4) { //setSelected called by a 1 or a 0 in the checks for each condiment, and order number //checks [0] is order number 1. checks [0] [0-6] are the condiments variables for all condiments if (checks [0] [0] = = 1) {cheese. setSelected (true); } else if (checks [0] [0] = = 0) {cheese. setSelected (false); }; if (checks [0] [1] = = 1) {ketchup. setSelected (true); } else if (checks [0] [1] = = 0) {ketchup. setSelected (false); }; if (checks [0] [2] = = 1) {onions. setSelected (true); } else if (checks [0] [2] = = 0) {onions. setSelected (false); }; if (checks [0] [3] = = 1) {pickles. setSelected (true); } else if (checks [0] [3] = = 0) {pickles. setSelected (false); }; if (checks [0] [4] = = 1) {mustard. setSelected (true); } else if (checks [0] [4] = = 0) {mustard. setSelected (false); }; if (checks [0] [5] = = 1) {lettuce. setSelected (true); } else if (checks [0] [5] = = 0) {lettuce. setSelected (false); }; if (checks [0] [6] = = 1) {tomato's. setSelected (true); } else if (checks [0] [6] = = 0) {tomato's. setSelected (false); }; } else if (order num = = 5) { if (checks [1] [0] = = 1) {cheese. setSelected (true); } else if (checks [1] [0] = = 0) {cheese. setSelected (false); }; if (checks [1] [1] = = 1) {ketchup. setSelected (true); } else if (checks [1] [1] = = 0) {ketchup. setSelected (false); }; if (checks [1] [2] = = 1) {onions. setSelected (true); } else if (checks [1] [2] = = 0) {onions. setSelected (false); }; if (checks [1] [3] = = 1) {pickles. setSelected (true); } else if (checks [1] [3] = = 0) {pickles. setSelected (false); }; if (checks [1] [4] = = 1) {mustard. setSelected (true); } else if (checks [1] [4] = = 0) {mustard. setSelected (false); }; if (checks [1] [5] = = 1) {lettuce. setSelected (true); } else if (checks [1] [5] = = 0) {lettuce. setSelected (false); }; if (checks [1] [6] = = 1) {tomato's. setSelected (true); } else if (checks [1] [6] = = 0) {tomato's. setSelected (false); }; } else if (order num = = 6) { if (checks [2] [0] = = 1) {cheese. setSelected (true); } else if (checks [2] [0] = = 0) {cheese. setSelected (false); }; if (checks [2] [1] = = 1) {ketchup. setSelected (true); } else if (checks [2] [1] = = 0) {ketchup. setSelected (false); }; if (checks [2] [2] = = 1) {onions. setSelected (true); } else if (checks [2] [2] = = 0) {onions. setSelected (false); }; if (checks [2] [3] = = 1) {pickles. setSelected (true); } else if (checks [2] [3] = = 0) {pickles. setSelected (false); }; if (checks [2] [4] = = 1) {mustard. setSelected (true); } else if (checks [2] [4] = = 0) {mustard. setSelected (false); }; if (checks [2] [5] = = 1) {lettuce. setSelected (true); } else if (checks [2] [5] = = 0) {lettuce. setSelected (false); }; if (checks [2] [6] = = 1) {tomato's. setSelected (true); } else if (checks [2] [6] = = 0) {tomato's. setSelected (false); }; } else if (order num = = 1) { if (checks [0] [0] = = 1) {cheese. setSelected (true); } else if (checks [0] [0] = = 0) {cheese. setSelected (false); }; if (checks [0] [1] = = 1) {ketchup. setSelected (true); } else if (checks [0] [1] = = 0) {ketchup. setSelected (false); }; if (checks [0] [2] = = 1) {onions. setSelected (true); } else if (checks [0] [2] = = 0) {onions. setSelected (false); }; if (checks [0] [3] = = 1) {pickles. setSelected (true); } else if (checks [0] [3] = = 0) {pickles. setSelected (false); }; if (checks [0] [4] = = 1) {mustard. setSelected (true); } else if (checks [0] [4] = = 0) {mustard. setSelected (false); }; if (checks [0] [5] = = 1) {lettuce. setSelected (true); } else if (checks [0] [5] = = 0) {lettuce. setSelected (false); }; if (checks [0] [6] = = 1) {tomato's. setSelected (true); } else if (checks [0] [6] = = 0) {tomato's. setSelected (false); }; } else if (order num = = 2) { if (checks [1] [0] = = 1) {cheese. setSelected (true); } else if (checks [1] [0] = = 0) {cheese. setSelected (false); }; if (checks [1] [1] = = 1) {ketchup. setSelected (true); } else if (checks [1] [1] = = 0) {ketchup. setSelected (false); }; if (checks [1] [2] = = 1) {onions. setSelected (true); } else if (checks [1] [2] = = 0) {onions. setSelected (false); }; if (checks [1] [3] = = 1) {pickles. setSelected (true); } else if (checks [1] [3] = = 0) {pickles. setSelected (false); }; if (checks [1] [4] = = 1) {mustard. setSelected (true); } else if (checks [1] [4] = = 0) {mustard. setSelected (false); }; if (checks [1] [5] = = 1) {lettuce. setSelected (true); } else if (checks [1] [5] = = 0) {lettuce. setSelected (false); }; if (checks [1] [6] = = 1) {tomato's. setSelected (true); } else if (checks [1] [6] = = 0) {tomato's. setSelected (false); }; } else if (order num = = 3) { if (checks [2] [0] = = 1) {cheese. setSelected (true); } else if (checks [2] [0] = = 0) {cheese. setSelected (false); }; if (checks [2] [1] = = 1) {ketchup. setSelected (true); } else if (checks [2] [1] = = 0) {ketchup. setSelected (false); }; if (checks [2] [2] = = 1) {onions. setSelected (true); } else if (checks [2] [2] = = 0) {onions. setSelected (false); }; if (checks [2] [3] = = 1) {pickles. setSelected (true); } else if (checks [2] [3] = = 0) {pickles. setSelected (false); }; if (checks [2] [4] = = 1) {mustard. setSelected (true); } else if (checks [2] [4] = = 0) {mustard. setSelected (false); }; if (checks [2] [5] = = 1) {lettuce. setSelected (true); } else if (checks [2] [5] = = 0) {lettuce. setSelected (false); }; if (checks [2] [6] = = 1) {tomato's. setSelected (true); } else if (checks [2] [6] = = 0) {tomato's. setSelected (false); }; }}//Str ign create for the.
Creates as if 3 orders are there at all times, except 2 //orders may be nothing and have no visual or other effects to the order public void ordered {if (order num = 4) {item = order num -3; }else if (order num.