JAVA Оконное приложение

Узнай цену своей работы

Формулировка задачи:

Собственно: не работает половина логики прописанная в кнопке Total и Convert, не хочет считать налог, конвертировать валюту и т.д., т.п. Вообщем с кода работает только сумма Costs of Drinks, Meal, Delivery.Остальные лэйблы не пашут, хз почему, как по мне все правильно написано(писал по туториалу, плиз хелп)
import java.awt.EventQueue;
 
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
import java.awt.Color;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.JTabbedPane;
import javax.swing.JComboBox;
import javax.swing.JCheckBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JSeparator;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
 
public class Restaurants {
 
    private JFrame frame;
    private JTextField textField;
    private JTextField textField_1;
    private JTextField textField_2;
    private JTextField textField_4;
    private JTextField textField_5;
    
    double firstnum;
    double secondnum;
    double result;
    String operations;
    
    double[]i = new double[5];
    
    double Albanian_Lek = 127.340;
    double Armenian_Dram = 486.360;
    double Azerbaijani_Manat = 1.90653;
    double Belarusian_Ruble = 19.200;
    double Bosnia_And_Herzegovina_Convertible_Mark = 1.81940;
    double Bulgarian_Lev = 1.81933;
    double Croatian_Kuna = 6.97056;
    double Czech_Koruna = 25.1401;
    double Danish_Kron = 6.91785;
    double Georgian_Lari = 2.69250;
    double Hungarian_Forint = 288.364;
    double Icelandic_KrГіna = 115.455;
    double Kazakhstani_Tenge = 328.235;
    double Swiss_Franc = 0.999107;
    double Macedonian_Denar = 57.1023;
    double Norwegian_Krone = 8.30951;
    double Polish_Zloty = 4.05086;
    double Romanian_Leu = 4.18631;
    double Moldovan_Leu = 19.9450;
    double Russian_Ruble = 59.4979;
    double Serbian_Dinar = 115.240;
    double Swedish_Krona = 8.81659;
    double Turkish_Lira = 3.83387;
    double Ukrainian_Hryvnia = 27.1400;
    double Pound_Sterling = 0.791484;
    double Euro = 0.930268;
    
    protected JLabel label_5;
    private JTextField textField_3;
     
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    Restaurants window = new Restaurants();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
 
    /**
     * Create the application.
     */
    public Restaurants() {
        initialize();
    }
 
    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        frame = new JFrame();
        frame.setBounds(0, 0, 1368, 768);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().setLayout(null);
        
        JPanel panel = new JPanel();
        panel.setBorder(new LineBorder(new Color(0, 0, 0), 8));
        panel.setBounds(34, 101, 535, 308);
        frame.getContentPane().add(panel);
        panel.setLayout(null);
        
        JLabel lblChickenBurger = new JLabel("Chicken Burger");
        lblChickenBurger.setFont(new Font("Tahoma", Font.PLAIN, 24));
        lblChickenBurger.setBounds(28, 25, 168, 29);
        panel.add(lblChickenBurger);
        
        JLabel lblChickenBurgerMeal = new JLabel("Chicken Burger Meal");
        lblChickenBurgerMeal.setFont(new Font("Tahoma", Font.PLAIN, 24));
        lblChickenBurgerMeal.setBounds(28, 65, 224, 29);
        panel.add(lblChickenBurgerMeal);
        
        JLabel lblCheeseburger = new JLabel("Cheese Burger");
        lblCheeseburger.setFont(new Font("Tahoma", Font.PLAIN, 24));
        lblCheeseburger.setBounds(28, 105, 156, 29);
        panel.add(lblCheeseburger);
        
        textField = new JTextField();
        textField.setHorizontalAlignment(SwingConstants.RIGHT);
        textField.setFont(new Font("Tahoma", Font.PLAIN, 24));
        textField.setBounds(262, 25, 261, 29);
        panel.add(textField);
        textField.setColumns(10);
        
        textField_1 = new JTextField();
        textField_1.setHorizontalAlignment(SwingConstants.RIGHT);
        textField_1.setFont(new Font("Tahoma", Font.PLAIN, 24));
        textField_1.setColumns(10);
        textField_1.setBounds(262, 65, 261, 29);
        panel.add(textField_1);
        
        textField_2 = new JTextField();
        textField_2.setHorizontalAlignment(SwingConstants.RIGHT);
        textField_2.setFont(new Font("Tahoma", Font.PLAIN, 24));
        textField_2.setColumns(10);
        textField_2.setBounds(262, 105, 261, 29);
        panel.add(textField_2);
        
        textField_4 = new JTextField();
        textField_4.setHorizontalAlignment(SwingConstants.RIGHT);
        textField_4.setFont(new Font("Tahoma", Font.PLAIN, 24));
        textField_4.setColumns(10);
        textField_4.setBounds(262, 207, 261, 29);
        panel.add(textField_4);
        
        JLabel lblQty = new JLabel("Quantity");
        lblQty.setFont(new Font("Tahoma", Font.PLAIN, 24));
        lblQty.setBounds(262, 167, 156, 29);
        panel.add(lblQty);
        
        JLabel lblDrink = new JLabel("Drink");
        lblDrink.setFont(new Font("Tahoma", Font.PLAIN, 24));
        lblDrink.setBounds(28, 167, 156, 29);
        panel.add(lblDrink);
        
        JComboBox comboBox = new JComboBox();
        comboBox.setFont(new Font("Tahoma", Font.PLAIN, 20));
        comboBox.setModel(new DefaultComboBoxModel(new String[] {"Select a drink", "Apple Juice", "Carrot Juice", "Orange Juice", "Pineapple Juice", "Pomegranate Juice", "Raspberry Juice", "Strawberry Juice", "Tomato Juice", "Tea", "Cola", "Coffee", "Lemonade", "Ice Tea", "Ice Coffee"}));
        comboBox.setBounds(28, 207, 205, 29);
        panel.add(comboBox);
        
        JCheckBox chckbxHomeDelivery = new JCheckBox("Home Delivery");
        chckbxHomeDelivery.setFont(new Font("Tahoma", Font.PLAIN, 24));
        chckbxHomeDelivery.setBounds(28, 251, 190, 29);
        panel.add(chckbxHomeDelivery);
        
        JCheckBox chckbxTax = new JCheckBox("Tax");
        chckbxTax.setFont(new Font("Tahoma", Font.PLAIN, 24));
        chckbxTax.setBounds(262, 251, 190, 29);
        panel.add(chckbxTax);
        
        JSeparator separator = new JSeparator();
        separator.setBounds(28, 156, 495, 6);
        panel.add(separator);
        
        JPanel panel_1 = new JPanel();
        panel_1.setBorder(new LineBorder(new Color(0, 0, 0), 8));
        panel_1.setBounds(579, 101, 351, 308);
        frame.getContentPane().add(panel_1);
        panel_1.setLayout(null);
        
        JComboBox comboBox_1 = new JComboBox();
        comboBox_1.setModel(new DefaultComboBoxModel(new String[] {"Choose Country", "Albania", "Andorra", "Armenia", "Austria", "Azerbaijan", "Belarus", "Belgium", "Bosnia and Herzegovina", "Bulgaria", "Croatia", "Cyprus", "Czech Republic", "Denmark", "Estonia", "Finland", "France", "Georgia", "Germany", "Greece", "Hungary", "Iceland", "Ireland", "Italy", "Kazakhstan", "Kosovo", "Latvia", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Malta", "Moldova", "Monaco", "Montenegro", "Netherlands", "Norway", "Poland", "Portugal", "Romania", "Russia", "San Marino", "Serbia", "Slovakia", "Slovenia", "Spain", "Sweden", "Switzerland", "Turkey", "Ukraine", "United Kingdom (UK)"}));
        comboBox_1.setFont(new Font("Tahoma", Font.PLAIN, 20));
        comboBox_1.setBounds(77, 22, 205, 29);
        panel_1.add(comboBox_1);
        
        textField_5 = new JTextField();
        textField_5.setHorizontalAlignment(SwingConstants.RIGHT);
        textField_5.setFont(new Font("Tahoma", Font.PLAIN, 24));
        textField_5.setColumns(10);
        textField_5.setBounds(77, 83, 205, 29);
        panel_1.add(textField_5);
        
        JButton btnConvert = new JButton("Convert");
        btnConvert.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) 
        {
            double Dollar = Double.parseDouble(textField_5.getText());
            if (comboBox_1.getSelectedItem().equals("Albania"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Albanian_Lek);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Andorra"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Euro);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Armenia"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Armenian_Dram);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Austria"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Euro);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Azerbaijan"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Azerbaijani_Manat);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Belarus"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Belarusian_Ruble);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Belgium"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Euro);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Bosnia and Herzegovina"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Bosnia_And_Herzegovina_Convertible_Mark);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Bulgaria"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Bulgarian_Lev);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Croatia"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Croatian_Kuna);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Cyprus"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Euro);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Czech Republic"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Czech_Koruna);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Denmark"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Danish_Kron);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Estonia"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Euro);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("Finland"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Euro);
            label_5.setText(cConvert1);             
            }
            if (comboBox_1.getSelectedItem().equals("France"))
            {
            String cConvert1 = String.format("%.2f", Dollar * Euro);
            label_5.setText(cConvert1);             
            }           
}
});

Решение задачи: «JAVA Оконное приложение»

textual
Листинг программы
btnConvert.setFont(new Font("Tahoma", Font.PLAIN, 18));
        btnConvert.setBounds(43, 226, 107, 31);
        panel_1.add(btnConvert);
        
        JButton btnClose = new JButton("Close");
        btnClose.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) 
            {
                comboBox_1.setSelectedItem("Choose Country");
                textField_5.setText(null);
                label_5.setText(null);
                
            }
        });
        btnClose.setFont(new Font("Tahoma", Font.PLAIN, 18));
        btnClose.setBounds(207, 226, 107, 31);
        panel_1.add(btnClose);
        
        JLabel label_4 = new JLabel("");
        label_4.setHorizontalAlignment(SwingConstants.RIGHT);
        label_4.setFont(new Font("Tahoma", Font.PLAIN, 24));
        label_4.setBorder(new LineBorder(new Color(0, 0, 0), 2));
        label_4.setBounds(77, 150, 205, 29);
        panel_1.add(label_4);
        
        JPanel panel_2 = new JPanel();
        panel_2.setBorder(new LineBorder(new Color(0, 0, 0), 8));
        panel_2.setBounds(34, 420, 535, 175);
        frame.getContentPane().add(panel_2);
        panel_2.setLayout(null);
        
        JLabel lblCostOfDrinks = new JLabel("Cost of Drinks");
        lblCostOfDrinks.setFont(new Font("Tahoma", Font.PLAIN, 24));
        lblCostOfDrinks.setBounds(22, 23, 168, 29);
        panel_2.add(lblCostOfDrinks);
        
        JLabel lblCostOfMeal = new JLabel("Cost of Meal");
        lblCostOfMeal.setFont(new Font("Tahoma", Font.PLAIN, 24));
        lblCostOfMeal.setBounds(22, 74, 224, 29);
        panel_2.add(lblCostOfMeal);
        
        JLabel lblCostOf = new JLabel("Cost of Delivery");
        lblCostOf.setFont(new Font("Tahoma", Font.PLAIN, 24));
        lblCostOf.setBounds(22, 124, 182, 29);
        panel_2.add(lblCostOf);
        
        JLabel label_1 = new JLabel("");
        label_1.setHorizontalAlignment(SwingConstants.RIGHT);
        label_1.setFont(new Font("Tahoma", Font.PLAIN, 24));
        label_1.setBounds(256, 23, 256, 29);
        label_1.setBorder(new LineBorder(new Color(0, 0, 0), 2));
        panel_2.add(label_1);
        
        JLabel label_2 = new JLabel("");
        label_2.setHorizontalAlignment(SwingConstants.RIGHT);
        label_2.setFont(new Font("Tahoma", Font.PLAIN, 24));
        label_2.setBorder(new LineBorder(new Color(0, 0, 0), 2));
        label_2.setBounds(256, 74, 256, 29);
        panel_2.add(label_2);
        
        JLabel label_3 = new JLabel("");
        label_3.setHorizontalAlignment(SwingConstants.RIGHT);
        label_3.setFont(new Font("Tahoma", Font.PLAIN, 24));
        label_3.setBorder(new LineBorder(new Color(0, 0, 0), 2));
        label_3.setBounds(256, 124, 256, 29);
        panel_2.add(label_3);
        
        JPanel panel_3 = new JPanel();
        panel_3.setBorder(new LineBorder(new Color(0, 0, 0), 8));
        panel_3.setBounds(579, 420, 350, 175);
        frame.getContentPane().add(panel_3);
        panel_3.setLayout(null);
        
        JLabel label_Tax = new JLabel("");
        label_Tax.setBounds(158, 23, 160, 29);
        label_Tax.setHorizontalAlignment(SwingConstants.RIGHT);
        label_Tax.setFont(new Font("Tahoma", Font.PLAIN, 24));
        label_Tax.setBorder(new LineBorder(new Color(0, 0, 0), 2));
        panel_3.add(label_Tax);
        
        JLabel label_Sub_Total = new JLabel("");
        label_Sub_Total.setBounds(158, 74, 160, 29);
        label_Sub_Total.setHorizontalAlignment(SwingConstants.RIGHT);
        label_Sub_Total.setFont(new Font("Tahoma", Font.PLAIN, 24));
        label_Sub_Total.setBorder(new LineBorder(new Color(0, 0, 0), 2));
        panel_3.add(label_Sub_Total);
        
        JLabel label_Total = new JLabel("");
        label_Total.setBounds(158, 121, 160, 29);
        label_Total.setHorizontalAlignment(SwingConstants.RIGHT);
        label_Total.setFont(new Font("Tahoma", Font.PLAIN, 24));
        label_Total.setBorder(new LineBorder(new Color(0, 0, 0), 2));
        panel_3.add(label_Total);
        
        JLabel lblTax = new JLabel("Tax");
        lblTax.setBounds(27, 23, 110, 29);
        lblTax.setFont(new Font("Tahoma", Font.PLAIN, 24));
        panel_3.add(lblTax);
        
        JLabel lblSubTotal = new JLabel("Sub Total");
        lblSubTotal.setBounds(27, 74, 110, 29);
        lblSubTotal.setFont(new Font("Tahoma", Font.PLAIN, 24));
        panel_3.add(lblSubTotal);
        
        JLabel lblTotal = new JLabel("Total");
        lblTotal.setBounds(27, 121, 110, 29);
        lblTotal.setFont(new Font("Tahoma", Font.PLAIN, 24));
        panel_3.add(lblTotal);
        
        JPanel panel_4 = new JPanel();
        panel_4.setBorder(new LineBorder(new Color(0, 0, 0), 8));
        panel_4.setBounds(940, 101, 381, 494);
        frame.getContentPane().add(panel_4);
        panel_4.setLayout(null);
        
        JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
        tabbedPane.setBounds(32, 23, 339, 449);
        panel_4.add(tabbedPane);
        
        JPanel panel_6 = new JPanel();
        tabbedPane.addTab("Receipt", null, panel_6, null);
        panel_6.setLayout(null);
        
        textField_3 = new JTextField();
        textField_3.setEditable(false);
        textField_3.setHorizontalAlignment(SwingConstants.CENTER);
        textField_3.setBounds(10, 11, 314, 399);
        panel_6.add(textField_3);
        textField_3.setColumns(10);
        
        JPanel panel_7 = new JPanel();
        tabbedPane.addTab("Calculator", null, panel_7, null);
        
        JPanel panel_5 = new JPanel();
        panel_5.setBorder(new LineBorder(new Color(0, 0, 0), 8));
        panel_5.setBounds(34, 606, 1287, 112);
        frame.getContentPane().add(panel_5);
        panel_5.setLayout(null);
        
        JButton btnTotal = new JButton("Total");
        btnTotal.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) 
        {
            //-----------------------Client choices + price calculation-------------------------------
            double ChicBurger = Double.parseDouble(textField.getText());
            double iChicBurger = 2.39;
            double Burger;          
            Burger = (ChicBurger * iChicBurger);
            String pMeal = String.format("%.2f", Burger);
            label_2.setText(pMeal);
            
            double ChicBurgerMeal = Double.parseDouble(textField_1.getText());
            double iChicBurgerMeal = 4.39;
            double BurgerMeal = 2.39;           
            BurgerMeal = (ChicBurgerMeal * iChicBurgerMeal);
            String cbMeal = String.format("%.2f", BurgerMeal + Burger);
            label_2.setText(cbMeal);
            
            double CheeseBurger = Double.parseDouble(textField_2.getText());
            double CheeseBurgerPrice = 3.39;
            double CheeseBurgerMeal;            
            CheeseBurgerMeal = (CheeseBurger * CheeseBurgerPrice);
            String cheese = String.format("%.2f", CheeseBurgerMeal + BurgerMeal + Burger);
            label_2.setText(cheese);    
            
            //-------------Home Delivery----------------------------------
            double iDelivery = 3.39;
            if (chckbxHomeDelivery.isSelected())
            {
                String pDelivery = String.format("%.2f", iDelivery);
                label_3.setText(pDelivery);
            }           
            else
            {
                label_3.setText("0");  
            }
            
            //-------------Drinks----------------------------------------------------------
            double Drinks = Double.parseDouble(textField_4.getText());
            double Apple_Juice = 2.10 * Drinks;
            double Carrot_Juice = 2.30 * Drinks;
            double Orange_Juice = 1.90 * Drinks;
            double Pineapple_Juice = 2.40 * Drinks;
            double Pomegranate_Juice = 2.30 * Drinks;
            double Raspberry_Juice = 1.80* Drinks;
            double Strawberry_Juice = 1.70 * Drinks;
            double Tomato_Juice = 1.49 * Drinks;
            double Tea = 1.20 * Drinks;
            double Cola =  2.10 * Drinks;
            double Coffee = 2.50 * Drinks;
            double Lemonade = 1.20 * Drinks;
            double Ice_Tea = 1.40 * Drinks;
            double Ice_Coffee = 1.10 * Drinks;
            
            if (comboBox.getSelectedItem().equals("Apple Juice"))
            {
                String cApple_Juice = String.format("%.2f", Apple_Juice);
                label_1.setText(cApple_Juice);
            }
            if (comboBox.getSelectedItem().equals("Carrot Juice"))
            {
                String cCarrot_Juice = String.format("%.2f", Carrot_Juice);
                label_1.setText(cCarrot_Juice);
            }
            if (comboBox.getSelectedItem().equals("Orange Juice"))
            {
                String cOrange_Juice = String.format("%.2f", Orange_Juice);
                label_1.setText(cOrange_Juice);
            }
            if (comboBox.getSelectedItem().equals("Pineapple Juice"))
            {
                String cPineapple_Juice = String.format("%.2f", Pineapple_Juice);
                label_1.setText(cPineapple_Juice);
            }
            if (comboBox.getSelectedItem().equals("Pomegranate Juice"))
            {
                String cPomegranate_Juice = String.format("%.2f", Pomegranate_Juice);
                label_1.setText(cPomegranate_Juice);
            }
            if (comboBox.getSelectedItem().equals("Raspberry Juice"))
            {
                String cRaspberry_Juice = String.format("%.2f", Raspberry_Juice);
                label_1.setText(cRaspberry_Juice);
            }
            if (comboBox.getSelectedItem().equals("Strawberry Juice"))
            {
                String cStrawberry_Juice = String.format("%.2f", Strawberry_Juice);
                label_1.setText(cStrawberry_Juice);
            }
            if (comboBox.getSelectedItem().equals("Tomato Juice"))
            {
                String cTomato_Juice = String.format("%.2f", Tomato_Juice);
                label_1.setText(cTomato_Juice);
            }
            if (comboBox.getSelectedItem().equals("Tea"))
            {
                String cTea = String.format("%.2f", Tea);
                label_1.setText(cTea);
            }
            if (comboBox.getSelectedItem().equals("Cola"))
            {
                String cCola = String.format("%.2f", Cola);
                label_1.setText(cCola);
            }
            if (comboBox.getSelectedItem().equals("Coffee"))
            {
                String cCoffee = String.format("%.2f", Coffee);
                label_1.setText(cCoffee);
            }
            if (comboBox.getSelectedItem().equals("Lemonade"))
            {
                String cLemonade = String.format("%.2f", Lemonade);
                label_1.setText(cLemonade);
            }
            if (comboBox.getSelectedItem().equals("Ice Tea"))
            {
                String cIce_Tea = String.format("%.2f", Ice_Tea);
                label_1.setText(cIce_Tea);
            }
            if (comboBox.getSelectedItem().equals("Ice_Coffee"))
            {
                String cIce_Coffee = String.format("%.2f", Ice_Coffee);
                label_1.setText(cIce_Coffee);
            }
            if (comboBox.getSelectedItem().equals("Select a drink"))
            {
                label_1.setText("0");
            }   
            
            double cTotal1 = Double.parseDouble(label_1.getText());    //drinks
            double cTotal2 = Double.parseDouble(label_2.getText());    //meal
            double cTotal3 = Double.parseDouble(label_3.getText());    //delivery
            double AllTotal = (cTotal1+cTotal2+cTotal3)/100;
            if(chckbxTax.isSelected()) 
            {
                String iTotal = String.format("%.2f", AllTotal);
                label_Tax.setText(iTotal);              
            }
            //-------------------------Total-----------------------------
            double cTotal4 = Double.parseDouble(label_Tax.getText());
            double subTotal = (cTotal1+cTotal2+cTotal3);
            String iSubTotal = String.format("$ %.2f", subTotal);
            label_Sub_Total.setText(iSubTotal);
            
            double allTotal = (cTotal1 + cTotal2 + cTotal3 + cTotal4);
            String iTotal = String.format("$ %.2f", allTotal);
            label_Total.setText(iTotal);
            
            String iTaxTotal = String.format("$ %.2f", cTotal4);
            label_Tax.setText(iTaxTotal);           
        }
        });
        btnTotal.setFont(new Font("Tahoma", Font.PLAIN, 18));
        btnTotal.setBounds(356, 42, 114, 36);
        panel_5.add(btnTotal);
        
        JButton btnReceipt = new JButton("Receipt");
        btnReceipt.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) 
            {
                double Qty1 = Double.parseDouble(textField.getText());
                double Qty2 = Double.parseDouble(textField_1.getText());
                double Qty3 = Double.parseDouble(textField_2.getText());
                
                textField_3.setText("Restaurants Management Systems" + "Chicken Burger:" 
                + Qty1 + "Chicken Burger Meal:\n" 
                + Qty2 + "Bacon and Cheese Burger:\n"
                + Qty3 + "Thanks for using our service\n");                 
            }
        });
        btnReceipt.setFont(new Font("Tahoma", Font.PLAIN, 18));
        btnReceipt.setBounds(521, 42, 122, 36);
        panel_5.add(btnReceipt);
        
        JButton btnReset = new JButton("Reset");
        btnReset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) 
        {
            textField.setText(null);
            textField_1.setText(null);
            textField_2.setText(null);
            textField_3.setText(null);          
            textField_4.setText(null);  
            textField_5.setText(null);
            comboBox.setSelectedItem("Select a drink");
            comboBox_1.setSelectedItem("Choose Country");
            chckbxTax.setSelected(false);
            chckbxHomeDelivery.setSelected(false);
            label_2.setText(null);
            label_3.setText(null);
            label_Tax.setText(null);
            label_Sub_Total.setText(null);
            label_Total.setText(null);
            label_4.setText(null);
            label_1.setText(null);      
            
        }
        });
        btnReset.setFont(new Font("Tahoma", Font.PLAIN, 18));
        btnReset.setBounds(688, 42, 114, 36);
        panel_5.add(btnReset);
        
        JButton btnExit = new JButton("Exit");
        btnExit.setFont(new Font("Tahoma", Font.PLAIN, 18));
        btnExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) 
        {
                System.exit(0);
        }
        });
        btnExit.setBounds(845, 42, 114, 36);
        panel_5.add(btnExit);
        
        JLabel lblNewLabel = new JLabel("Loan Management Systems");
        lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
        lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 70));
        lblNewLabel.setBounds(34, 11, 1287, 85);
        frame.getContentPane().add(lblNewLabel);
    }
}

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

12   голосов , оценка 4.333 из 5