Can't get my inventory program to compile

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zaidalin79
    New Member
    • Nov 2006
    • 59

    #61
    Sorry, forgot the buttons... ignore the other one...
    I am posting my most recent one next...

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #62
      With practice you'll soon do away with the typing errors and be able able spot ways of making the code optimal

      Do you think I't's possible to add a capability to add Products insted of jusy viewing them?

      [code removed as per site rules - see FAQ]
      Last edited by MMcCarthy; Feb 20 '07, 05:57 AM. Reason: removing program code

      Comment

      • zaidalin79
        New Member
        • Nov 2006
        • 59

        #63
        I hope you are right-doesn't feel like it now...

        Adding that functionality is part of the last assignment I think...

        • 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\invento ry.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.

        Comment

        • zaidalin79
          New Member
          • Nov 2006
          • 59

          #64
          How do I fix the name so that it displays something different for each item? That seems to be an issue with her... Maybe I could put in a model number instead, and call the MobilePhone the product type?

          Comment

          • zaidalin79
            New Member
            • Nov 2006
            • 59

            #65
            and, can I insert a real picture from a file?

            Comment

            • r035198x
              MVP
              • Sep 2006
              • 13225

              #66
              Originally posted by zaidalin79
              How do I fix the name so that it displays something different for each item? That seems to be an issue with her... Maybe I could put in a model number instead, and call the MobilePhone the product type?
              Well why don't you add these additional buttons then. Let's have have them on a different panel from the one with the other buttons. Just add them to the interface and we'll work on their actions one by one

              [code removed as per site rules - see FAQ]

              Comment

              • zaidalin79
                New Member
                • Nov 2006
                • 59

                #67
                I think we also need an exit statement... every time i run it-it gets stuck...

                Comment

                • r035198x
                  MVP
                  • Sep 2006
                  • 13225

                  #68
                  Originally posted by zaidalin79
                  I think we also need an exit statement... every time i run it-it gets stuck...
                  [code removed as per site rules - see FAQ]

                  Done. Now are you going to add the other buttons?
                  Last edited by MMcCarthy; Feb 20 '07, 05:55 AM. Reason: removing program code

                  Comment

                  • zaidalin79
                    New Member
                    • Nov 2006
                    • 59

                    #69
                    I m trying... just a sec... dont go away

                    Comment

                    • r035198x
                      MVP
                      • Sep 2006
                      • 13225

                      #70
                      Originally posted by zaidalin79
                      and, can I insert a real picture from a file?
                      You obviously missed this part of the code

                      Code:
                       
                      private class MyPanel extends JPanel {
                      	ImageIcon image = new ImageIcon("Sample.jpg");
                      	int  width  = image.getIconWidth();
                      	int  height  = image.getIconHeight();
                      	long angle = 30;
                      	public MyPanel(){
                      	 super();
                      	}
                      	public void paintComponent(Graphics g){
                      	   super.paintComponent(g);
                      	   Graphics2D g2d = (Graphics2D)g;
                      	   g2d.rotate (Math.toRadians(angle), 60+width/2, 60+height/2);
                      	   g2d.drawImage(image.getImage(), 60, 60, this);
                      	   g2d.dispose();
                      	}
                       }//end
                      If you put a picture called Sample.jpg in the folder that contains the code the picture appears on the frame rotated at 60 degs. Alternatively, you could change the name of the picture to one that you have.

                      Comment

                      • zaidalin79
                        New Member
                        • Nov 2006
                        • 59

                        #71
                        No, I didn't miss it... you answered my question... Ok-it doesn't compile, but I tried to add the other field...

                        [code removed as per site rules - see FAQ]
                        Last edited by MMcCarthy; Feb 20 '07, 05:54 AM. Reason: removing program code

                        Comment

                        • r035198x
                          MVP
                          • Sep 2006
                          • 13225

                          #72
                          Why are you replacing brand with type?

                          Comment

                          • zaidalin79
                            New Member
                            • Nov 2006
                            • 59

                            #73
                            The brand wasn't showing a different value for each item... it was showing MobilePhone for all of them instead of Motorola/Nokia etc... I was trying to fix it so that it said type=MobilePhon e instead, and then the different brands would show up for each item... was that wrong?

                            Comment

                            • r035198x
                              MVP
                              • Sep 2006
                              • 13225

                              #74
                              Originally posted by zaidalin79
                              The brand wasn't showing a different value for each item... it was showing MobilePhone for all of them instead of Motorola/Nokia etc... I was trying to fix it so that it said type=MobilePhon e instead, and then the different brands would show up for each item... was that wrong?
                              This last version that I posted was doing that using brand and Item name only

                              [code removed as per site rules - see FAQ]

                              Comment

                              • zaidalin79
                                New Member
                                • Nov 2006
                                • 59

                                #75
                                My fault, I see what you are saying... It looks like the Brand and the Item Name are switched though... Is that just the label?

                                Comment

                                Working...