| | |
Out of 9 Lives - The Dreaded Inventory Prog
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2007
Posts: 2
Reputation:
Solved Threads: 0
I have all of my program working except the following buttons (add, modify, delete, save, search) which I have the buttons, but turned off in my program so it will still compile/run until I get the button functionality fixed. To be honest, I have no clue on what code needs to make them work as required. I am strictly a beginner and it has taken many many sleepless nights just to get to this point. Any help would be very much appreciated.
The following is what I need to accomplish, followed by my section of code (as not to overwhelm you with my whole program):
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 NEED HELP WITH THIS SECTION. HAVE NO CLUE ON WHAT CODE WILL MAKE BUTTONS WORK AS REQUESTED
// private JButton addButton = new JButton(addAction);
//private Action lastAction = new AbstractAction("Add") {
// public void actionPerformed(ActionEvent evt) {
//index = ProductInventory.getSize() - 1;
// repaint();
// }
// };
// private JButton modifyButton = new JButton(modifyAction);
// private Action lastAction = new AbstractAction("Modify") {
// public void actionPerformed(ActionEvent evt) {
// index = ProductInventory.getSize() - 1;
// repaint();
// }
// };
//private JButton deleteButton = new JButton(deleteAction);
//private Action lastAction = new AbstractAction("Delete") {
// public void actionPerformed(ActionEvent evt) {
// index = ProductInventory.getSize() - 1;
// repaint();
// }
//};
// private JButton saveButton = new JButton(saveAction);
// private Action lastAction = new AbstractAction("Save") {
// public void actionPerformed(ActionEvent evt) {
// index = ProductInventory.getSize() - 1;
// repaint();
// }
//};
//private JButton searchButton = new JButton(searchAction);
//private Action lastAction = new AbstractAction("Search") {
// public void actionPerformed(ActionEvent evt) {
// index = ProductInventory.getSize() - 1;
// repaint();
// }
//};
The following is what I need to accomplish, followed by my section of code (as not to overwhelm you with my whole program):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 NEED HELP WITH THIS SECTION. HAVE NO CLUE ON WHAT CODE WILL MAKE BUTTONS WORK AS REQUESTED
// private JButton addButton = new JButton(addAction);
//private Action lastAction = new AbstractAction("Add") {
// public void actionPerformed(ActionEvent evt) {
//index = ProductInventory.getSize() - 1;
// repaint();
// }
// };
// private JButton modifyButton = new JButton(modifyAction);
// private Action lastAction = new AbstractAction("Modify") {
// public void actionPerformed(ActionEvent evt) {
// index = ProductInventory.getSize() - 1;
// repaint();
// }
// };
//private JButton deleteButton = new JButton(deleteAction);
//private Action lastAction = new AbstractAction("Delete") {
// public void actionPerformed(ActionEvent evt) {
// index = ProductInventory.getSize() - 1;
// repaint();
// }
//};
// private JButton saveButton = new JButton(saveAction);
// private Action lastAction = new AbstractAction("Save") {
// public void actionPerformed(ActionEvent evt) {
// index = ProductInventory.getSize() - 1;
// repaint();
// }
//};
//private JButton searchButton = new JButton(searchAction);
//private Action lastAction = new AbstractAction("Search") {
// public void actionPerformed(ActionEvent evt) {
// index = ProductInventory.getSize() - 1;
// repaint();
// }
//};
You should check answer to your first post where I provided a link to other post with same problem as yours. Based on that you would get some ideas what to do with it
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- Prog and Logic Question for beginner (Legacy and Other Languages)
- ...you guessed it, the dreaded C000021a {Fatal System Error} (Windows NT / 2000 / XP)
- PHP Tripod (PHP)
- hijackthis log pls help quick (Viruses, Spyware and other Nasties)
- VB Programming - Inventory Program (Visual Basic 4 / 5 / 6)
- help with this prog (C++)
- Prog to list ASCII codes (beginners' stuff) (C)
- Program runs in an infinite loop (C++)
Other Threads in the Java Forum
- Previous Thread: what happen during program setup??
- Next Thread: Inventory part 5
| Thread Tools | Search this Thread |
3d 6 @param affinetransform android api applet application arc array arrays automation binary bluetooth bold byte c++ chat class classes click client code compare component coordinates database detection doctype draw eclipse educational error event exception file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework html ide ideas image ingres input integer internet intersect j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list loop map method methods mobile netbeans newbie nextline oracle pong print problem program programming project recursion recursive rim scanner screen sell server set size sms sort sql string swing terminal threads time tree user web websites windows






