fix up my java code and make it shorter: public class PizzaOrder extends JFrame {…
- User
fix up my java code and make it shorter: public class PizzaOrder extends JFrame { private JPanel contentPane; private JPanel ToppingSelect; private JTextField NumPizza; private JTextField NumTopping; private JTextField NumBreuvage; private JButton Ajouter; private double totales = 0; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { PizzaOrder frame = new PizzaOrder(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace();
} } });
} public PizzaOrder() {
setTitle(“Order”); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 630, 689); contentPane = new JPanel(); contentPane.setBackground(new Color(255, 147, 0)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane); contentPane.setLayout(null);
JPanel Menu = new JPanel(); Menu.setBackground(new Color(255, 147, 0)); Menu.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), “Menu”, TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0))); Menu.setBounds(6, 6, 618, 158); contentPane.add(Menu); Menu.setLayout(new GridLayout(0, 3, 0, 0));
JPanel PizzaPrice = new JPanel(); PizzaPrice.setBackground(new Color(255, 147, 0)); PizzaPrice.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), “Pizza”, TitledBorder.LEADING, TitledBorder.TOP, null, null)); Menu.add(PizzaPrice); PizzaPrice.setLayout(null);
JLabel PetitPizza = new JLabel(“Petit: 6.79$”); PetitPizza.setBounds(17, 21, 72, 16); PizzaPrice.add(PetitPizza);
JLabel MoyenPizza = new JLabel(“Moyen: 8.29$”); MoyenPizza.setBounds(17, 40, 85, 16); PizzaPrice.add(MoyenPizza);
JLabel LargePizza = new JLabel(“Large: 9.49$”); LargePizza.setBounds(17, 59, 85, 16); PizzaPrice.add(LargePizza);
JLabel ExtraLargePizza = new JLabel(“Extra Large: 10.29$”); ExtraLargePizza.setBounds(17, 78, 127, 16); PizzaPrice.add(ExtraLargePizza);
JLabel FetePizza = new JLabel(“Fete: 15.99$”); FetePizza.setBounds(17, 97, 93, 16); PizzaPrice.add(FetePizza);
JPanel ToppingPrice = new JPanel(); ToppingPrice.setBackground(new Color(255, 147, 0)); ToppingPrice.setLayout(null); ToppingPrice.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), “Toppings”, TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0))); Menu.add(ToppingPrice);
JLabel Petittopping = new JLabel(“Petit: 1.20$”); Petittopping.setBounds(17, 21, 72, 16); ToppingPrice.add(Petittopping);
JLabel Moyentopping = new JLabel(“Moyen: 1.40$”); Moyentopping.setBounds(17, 40, 85, 16); ToppingPrice.add(Moyentopping);
JLabel Largetopping = new JLabel(“Large: 1.60$”); Largetopping.setBounds(17, 59, 85, 16); ToppingPrice.add(Largetopping);
JLabel ExtraLargetopping = new JLabel(“Extra Large: 1.80$”); ExtraLargetopping.setBounds(17, 78, 127, 16); ToppingPrice.add(ExtraLargetopping);
- Assistant