|
Final Inventory tweeks
Assignment:
• Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the GUI. These buttons should allow the user to perform the 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 C:\data\inventory.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.
I have added the buttons that I need, the graphic (cheesy, I know) and put the import java.io.*; utitility in the code. The additem function works propery but the delete, search, modify and save buttons need to funcition as described before thus the import java.io.*; at the top of the code. I reviewed a forum for saving data that has this code:
public class InputFile1
{
public static void main (String args[]) throws IOException
{
final FileWriter inputthingy = new FileWriter("inputfile1.dat");
final BufferedWriter bufferthingy = new BufferedWriter(inputthingy);
final PrintWriter printythingy = new PrintWriter(bufferthingy);
try {
printythingy.println ("Hello inputthingy file");
System.out.println("File write successful");
} catch (Exception e) {
System.out.println("Error writing to file");
}
bufferthingy.close();
System.exit(0);
}
}
What should I change to get this to work in my existing code that I will post in the next reply section. Thanks for your help
Badness
|