Made In China Talk  

Go Back   Made In China Talk > International Business Talk > Import > Food & Beverage
Directory Register FAQ Members List Calendar Mark Forums Read 中文


Help Me with Java GUI?


Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2009, 02:57 AM
John John is offline
Senior Member
 
Join Date: May 2008
Posts: 2,095
Feedback: (0)
Default Help Me with Java GUI?

For a project in my horrible java course I have to make a GUI that is a pizza ordering program. If someone could help me with any of these things it would be great :Change the background. (To another type of background etc.) Change the top bar where the title is. (Not the title the bar.)Make separate tabs for toppings, size, how to order and submit/cancel.import java.awt.*;import javax.swing.*;import java.awt.event.*;import java.util.*;public class pizzaProject extends JFrame implements ActionListener, ItemListener{ private JLabel lname, lsize, ltoppings, ldilivery; private JRadioButton rsizeS, rsizeM, rsizeL, rsizeXL, rDelivery, rPickup; private JCheckBox cBacon, cBBQ_Chicken, cBeef, cCajun_Chicken, cChicken_Masala, cChicken_Tikka, cChorizo, cDuck, cHam, cHoney_Cured_Ham, cMeatballs, cPepperoni, cProscuitto, cSalami, cSausage, cSerrano_Ham, cTurkey, cVenison; private JButton bOK, bCancel; private JTextField tName; private boolean cSelected = false; private boolean rSelected = false; private boolean rSelectedS = false; private String sDelivery; private String sSize; private String sPickup; private String toppings; private int i=0; public pizzaProject() { JFrame myFrame = new JFrame("Meaty Pizza Palace order form:"); tName = new JTextField("", 25); lname = new JLabel("Enter your first and last name:"); lsize = new JLabel("Select the size:"); ltoppings = new JLabel("Select the topping(s):"); ldilivery = new JLabel("Select how you want to get your pizza:"); cBacon = new JCheckBox("Bacon", false); cBBQ_Chicken = new JCheckBox("BBQ Chicken", false); cBeef = new JCheckBox("Beef", false); cCajun_Chicken = new JCheckBox("Cajun Chicken", false); cChicken_Masala = new JCheckBox("Chicken Masala", false); cChicken_Tikka = new JCheckBox("Chicken Tikka", false); cChorizo = new JCheckBox("Chorizo", false); cDuck = new JCheckBox("Duck", false); cHam = new JCheckBox("Ham", false); cHoney_Cured_Ham = new JCheckBox("Honey Cured Ham", false); cMeatballs = new JCheckBox("Meatballs", false); cPepperoni = new JCheckBox("Pepperoni", false); cProscuitto = new JCheckBox("Proscuitto", false); cSalami = new JCheckBox("Salami", false); cSausage= new JCheckBox("Sausage", false); cSerrano_Ham = new JCheckBox("Serrano Ham", false); cTurkey = new JCheckBox("Turkey", false); cVenison = new JCheckBox("Venison", false); cBacon.addItemListener(this); cBBQ_Chicken.addItemListener(this); cBeef.addItemListener(this); cCajun_Chicken.addItemListener(this); cChicken_Masala.addItemListener(this); cChicken_Tikka.addItemListener(this); cChorizo.addItemListener(this); cDuck.addItemListener(this); cHam.addItemListener(this); cHoney_Cured_Ham.addItemListener(this); cMeatballs.addItemListener(this); cPepperoni.addItemListener(this); cProscuitto.addItemListener(this); cSalami.addItemListener(this); cSausage.addItemListener(this); cSerrano_Ham.addItemListener(this); cTurkey.addItemListener(this); cVenison.addItemListener(this); bOK = new JButton("Submit Order"); bCancel = new JButton("Clear Order"); bOK.addActionListener(this); bCancel.addActionListener(this); rsizeS = new JRadioButton("Small", false); rsizeM = new JRadioButton("Medium", false); rsizeL = new JRadioButton("Large", false); rsizeXL = new JRadioButton("Extra Large", false); rsizeS.addItemListener(this); rsizeM.addItemListener(this); rsizeL.addItemListener(this); rsizeXL.addItemListener(this); rDelivery = new JRadioButton("Delivery", false); rPickup = new JRadioButton("Pickup", false); rDelivery.addItemListener(this); rPickup.addItemListener(this); ButtonGroup myBG1 = new ButtonGroup(); myBG1.add(rDelivery); myBG1.add(rPickup); ButtonGroup myBG2 = new ButtonGroup(); myBG2.add(rsizeS); myBG2.add(rsizeM); myBG2.add(rsizeL); myBG2.add(rsizeXL); myFrame.getContentPane().setLayout(new FlowLayout()); myFrame.getContentPane().add(lname); myFrame.getContentPane().add(tName); myFrame.getContentPane().add(ldilivery); myFrame.getContentPane().add(rDelivery); myFrame.getContentPane().add(rPickup); sSize = ""; myFrame.getContentPane().add(lsize); myFrame.getContentPane().add(rsizeS); myFrame.getContentPane().add(rsizeM); myFrame.getContentPane().add(rsizeL); myFrame.getContentPane().add(rsizeXL); toppings = "no toppi
Reply With Quote


  #2  
Old 07-06-2009, 02:57 AM
India India is offline
Senior Member
 
Join Date: May 2008
Posts: 2,080
Feedback: (0)
Default Help Me with Java GUI?

Handcoding java interfaces really sucks. If you're allowed to, I'd suggest using a drag and drop Editor, such as Netbeans.. It'll greatly simplify the building, especially the tabs. Other than, the javadocs are the best place to start.
Reply With Quote
Reply



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


| UK Articles | find a job in china | China Video Chat | Business | Free Articles | Luxury Homes in the US | Bluehost coupons | Bluehost coupons | Hostmonster coupons | Hostmonster coupons | Online Marketing Tips - Earn Cash Money

All times are GMT +9. The time now is 05:02 PM.


All rights reserved. Copyright © 2007 Made In China Talk