I
need to make these changes to the following program by 1/08/08. Can
you please make
these
changes? We are using Netbeans as the compiler. This is Java
programming 215 and
the
textbook is how to program. I am overwhelmed at this point and cannot
keep up. I
will
probably have to take this class again to actually understand what it
requires, but
I
don’t have the time to do it right now. Can you help?
Modify
the Inventory program to include an Add button, a Delet button, and a
Modify
button
on the GUI. These buttons should allow the user to performt he
corresponding
actions
on the item name, the number of units in stock, and the price of each
unit. An
item
added to the inventory should have an item number one more than the
previous last
item.
Add
a Save button to the GUI that saves the inventory to a
:datainventory.dat file.
Use
exception handling to create the directory and file if necessary.
Add
a search button to the GUI that allows the user to search for an item
in the
inventory
by the product name. If the product is not found, the GUI should
display an
appropriate
message. If the product is found, the GUI should display that
product’s
information
in the GUI.
Here
is the Inventory program:
Inventory_Part6.java
//
Inventory_Part6.java
//
Inventory_Part6 constructs a GUI to display a product at a time and
has two buttons to
…
//
navigate within an array of products.
import
java.awt.Container;
import
java.awt.Dimension;
import
java.awt.GridBagConstraints;
import
java.awt.GridBagLayout;
import
java.awt.Insets;
import
java.awt.Toolkit;
import
java.awt.event.ActionEvent;
import
java.awt.event.ActionListener;
import
java.text.DecimalFormat;
import
javax.swing.JButton;
import
javax.swing.JFrame;
import
javax.swing.JLabel;
import
javax.swing.JTextField;
public
class Inventory_Part6 extends JFrame implements
ActionListener
{
private
static final String LABEL[] =
“Number:”,
“Name:”, “Number of Units:”, “Price:
$”,
“Title:”,
“Restocking Fee: $”, “Inventory Value: $”,
“Entire Inventory
Value:
$”;
private
JTextField numberField; // text field to display the product
number
private
JTextField nameField; // text field to display the product
name
private
JTextField unitsField; // text field to display the product number
of
units
private
JTextField priceField; // text field to display the product
price
private
JTextField inventoryField; // text field to display the product
inventory
private
JTextField uniqueAttributeField; // text field to display the
product
unique
attribute
private
JTextField restockingFeeField; // text field to display the
restocking fee
private
JTextField entireInventoryField; // text field to display the
entire
inventory
private
JButton previousButton; // button to move to the previous
product
private
JButton nextButton; // button to move to the next product
//
array of products
private
Sub[] subs;
//
create a tool that insure the specified format for a double number,
when displayed
private
DecimalFormat doubleFormat = new DecimalFormat( “0.00”
);
//
the index within the array of products of the current displayed
product
private
int currentProductIndex;
public
static void main(String[] args)
//
run the GUI application
Inventory_Part5
application = new Inventory_Part6();
//
the window should close when the X button is
pressed
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//
constructor
public
Inventory_Part6()
//
create an array of products with the specified length
subs
= new Sub[6];
subs[0]
= new Sub(1, “DVD”, 10, 10.99, “Airplane”);
subs[1]
= new Sub(2, “Game”, 12, 49.99, “Everquest”);
subs[2]
= new Sub(3, “CD”, 30, 12.99, “Green Day”);
subs[3]
= new Sub(4, “DVD”, 16, 19.99, “Lady and the
Tramp”);
subs[4]
= new Sub(5, “CD”, 19, 11.99, “Misfits”);
subs[5]
= new Sub(6, “Game”, 18, 19.77, “Spiderman”);
//
call the method which constructs the GUI
initGUI();
//
construct GUI and fill it with initial data
private
void initGUI()
{
//
set the title of the window
this.setTitle(“Inventory”);
Container
container = getContentPane(); // the container of this
window
GridBagLayout
layout = new GridBagLayout();
container.setLayout(layout);
// set a grid bag layout for this container
//
create a grid bag constraints to use it for each control of the
container
GridBagConstraints
constraints = new GridBagConstraints();
//
create Previous button and its constraints
previousButton
= new JButton(“Previous”);
constraints
= makeConstraints(1, 0, 1, 1,
2);
layout.setConstraints(previousButton,
constraints);
container.add(previousButton);
//
add an action listener implemented by this
class
previousButton.addActionListener(this);
previousButton.setActionCommand(previousButton.getText());
//
create Next button and its constraints
nextButton
= new JButton(” Next “);
constraints
= makeConstraints(2, 0, 1, 1, 2);
layout.setConstraints(nextButton,
constraints);
container.add(nextButton);
//
add an action listener implemented by this
class
nextButton.addActionListener(this);
nextButton.setAction
The post using Netbeans as the compiler appeared first on My Assignment Online.