Please fix this so when i press Addorder i am able to add the data and the when i press save the data works and is stored on a table to see on the gui

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter15: Using Javafx And Scene Builder
Section: Chapter Questions
Problem 12PE
icon
Related questions
Question
Please fix this so when i press Addorder i am able to add the data and the when i press save the data works and is stored on a table to see on the gui 
 
import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class OrderEntryScreen extends JFrame {
    private JTextField txttableNumber;
    private JTextField txtcapacity;
    private JTextField txtsubtotal;
    private JTextField txtID;
    private JTextField txtestimatedWaitTime;
    private JTextField txtDate;
    private JTextField txtTime;
    private JButton SaveCommand;
    private JButton commandCloser;
    private JButton ClearAll;
    // private JButton MakeOrder;
    // private JButton MakeReservation;
    private JCheckBox checkBox; // variable that was stated to be added for checkbox
    private Driver orderlist1; // Variable for PersonListing so we can create the instance
    // private Driver orderlist1;
    private JPanel pnlCommand;
    private JPanel pnlDisplay;
    private OrderEntryScreen orderEntry1; // needed to set visibility for false
    // private EntryScreen OrderEntry1;

    public OrderEntryScreen(Driver orderlist1) // <Argument here// call it from now so it can be
                                               // used
                                               // later
    // on
    {
        this.orderlist1 = orderlist1;

        setTitle("Make an Order");
        pnlCommand = new JPanel();
        pnlDisplay = new JPanel();

     

        pnlDisplay.add(new JLabel("Date:"));
        txtDate = new JTextField(5);
        pnlDisplay.add(txtDate);

        pnlDisplay.add(new JLabel("Time:"));
        txtTime = new JTextField(5);
        pnlDisplay.add(txtTime);

        // add Jlabel and will publish text with the checkbox object

        pnlDisplay.setLayout(new GridLayout(4, 2));//

        SaveCommand = new JButton("Save");
        commandCloser = new JButton("Close");

        pnlCommand.add(SaveCommand);
        pnlCommand.add(commandCloser);
        add(pnlDisplay, BorderLayout.CENTER);
        add(pnlCommand, BorderLayout.SOUTH);
        pack();
        setVisible(true);
        commandCloser.addActionListener(new commandCloser());
        SaveCommand.addActionListener(new SaveCommand());
        orderEntry1 = this;
    }

    private class commandCloser implements ActionListener {
        public void actionPerformed(ActionEvent d) {
            orderEntry1.setVisible(false);// don't want this to be shown hence false
        }
    }

    private class SaveCommand implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            String idString = txtID.getText();
            int id = Integer.parseInt(idString);
            String  esttime=txtestimatedWaitTime.getText();
            int estimatedWaitTime =  Integer.parseInt(esttime);
            String tableNum = txttableNumber.getText();
            int tableNumber = Integer.parseInt(tableNum);
            String Capacity = txtcapacity.getText();
            int capacity = Integer.parseInt(Capacity);
            String Subtotal = txtsubtotal.getText();
            int subtotal = Integer.parseInt(Subtotal);
            Order order = new Order(id, estimatedWaitTime, tableNumber, capacity, subtotal);

            orderlist1.addOrder(order);
            orderEntry1.setVisible(false);
            System.out.println("Close button clicked");
        }
    }
}
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Hyperlinks
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT