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
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
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
Knowledge Booster
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.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education