DVD length

Ok, I'm ready to record my class reunion onto IDVD. I'm confused about the length of recordings that DVD's can handle. A single layer DVD+R can hold 2 hours. So I decided to divide my 2 hours and 34 minutes into 2 DVD's. Now as I'm reading more about DVD's, it looks like I could get my entire movie onto one double-layer DVD. Would this be a good idea? When I originally tried to record in IDVD, it said my original 155 minutes wouldn't fit even on a double-layer DVD, which was what I had it set for.
So what's the answer?? Or would two single layer DVD's be better? And what's the most efficient way to copy these DVD's to sell to classmates? I'd like to pass them off to someone else to copy.

DVD's use MPEG-2 compression.
Compression is "variable" and adjusted by the encoding to "fit" a standard DVD media.
A "short" media source (say under an hour) will allow less compression than a 90 minute DVD. A two hour DVD is compressed to the "max" (to make it fit on the DVD media).
You may want to reconsider your goal. Not all DVD players can handle dual layer media. And, Blue Ray is right around the corner.
Your current plan is to break the 154 minutes into two DVD's. Better than using dual layer media (cheaper, too).
But you may get even better quality DVD's by breaking the source into three parts (52 minute "parts") because the compression schemes have more DVD "space" and the MPEG-2 file compression is even less than trying to fit on other media.

Similar Messages

  • DVD Length between 2-3 hours

    Hi Folks,
    I just finished a project in iMovie, which is 3h and 4GB.
    I get the project length error message. I know that iDVD don't burn DVD over 90 min. What is the work around, wenn I want to create a single DVD to accomodate the above specs, which could be played on most home DVD player!
    Which options do I have?
    thanks

    Most newer players support DVD+RW discs (last couple of years or so) I bought a couple inexpensive ones ($50-$70 range) to be able to view DLs I make on televisions.
    Really depends who will be getting the discs. There are also ultilties to reduce the size of the DVD-9 to DVD-5 (some loss of quality) after you make a DVD-9. Otherwise you will need something else to make the discs and tweak the enbcoding rates to fit the disc. Depending on the material (low action) you may be able to fit 3 hours on one DVD-5 disc with okay quality

  • HOW TO EXPORT FOR MAX DVD LENGTH?

    Here's my issue:
    I'm used to exporting my timeline from FCP using standard DV/NTSC QT conversion to then burn DVDs using DVD Studio Pro. But I can only seem to fit about an hour and 15 minutes max onto the DVD.
    I recently taped several long meetings for work that I'd like to fit on as few DVDs as possible.
    How do get more than a bit more than an hour on a DVD? Is this in the compression in FCP or DVD Studio Pro?
    Thanks in advance!

    Use Compressor. It has presets for 60min, 90 min, and 150min.
    Shane

  • More DVD length /encoding issues

    I've tried searching /reading most of the iDVD and don't think I've seen this issue; although I'm new to iDVD and this machine so please bear with me.
    I have set Quality to "Best", yet I still get the "Your project exceeds the maximum content duration. " iDVD gives me:
    Project:
    - total project duration: 79:16 minutes
    - total project capacity: 4.326 GB (max. available: 4.172 GB)
    Menus:
    - number of menus in project: 3 menus
    - total menu duration: 1:11 minutes
    - total menu capacity: 54.286 MB
    Movies:
    - total movies duration: 78:05 minutes
    - total movies capacity: 4.273 GB
    Are Single layer DVD's not capable of 79 minutes? Or is it only DLs that can handle two hours? I have only 6 relatively small pix in the Theme, no music or videos.
    Than-Q for any help anyone can suggest.

    It should work since on a single layer DVD you should be able to put as much as 120 minutes on it. You may have a corrupted preference file. I have seen that before where even though you have Best Quality checked, the program is still working under Best Performance. The fix is to find the iDVD preference file, trash it, start iDVD again, set the preference back to Best Quality (B.Perf is the default so you have to change it back again) and then try your project again and see if it now allows you to put your 80 minute project onto a DVD.
    Patrick

  • How Do I Detemine Maximum DVD Time For A PCM Audio DVD

    I have been working with my CS2 Premiere to create some auto play, audio-only DVDs that are autoplay.  To clear the air, yes I know that CS4 will permit 24bit-96 kHz.  For the time being 16 bit-48 kHz will suffice as it has CD quality  The bonus that a DVD format provides a greater playing times.  So the object is to make a PCM audio only DVD.
    Here is my problem: How to get really long playing time.  I know I can make high quality, 2-channel (ordinary stereo)  DVD-A's up to 3 hours using Minatonka Bronze.  Unfortunately, DVD-A discs are worthless as they cannot play in 90% of DVD players, but they prove the time point.  I would think that one should be able to make a conventional DVD, but with the PCM sound format of that same length.
    I just finished one that fit with a 103 minute, 16/48 stereo audio file of 1.11 GB size.   I also had a video file that I created using several photos. Sorry, don't have the final video file size.  I erased it all from my computer.  However, the final disc size was 3.754 GB.  A little extrapolation suggests a maximum DVD length of 119 minutes.  That with simple video and PCM audio.  Now, can one make a similar DVD with 150 minutes?
    I had three 48 kHz files that I created in Adobe Audion.  They were 1.599, 0.911, and 0.974 GBs in size.  That added up to 3.480.  The playing time is about 2:30 Hours; quite a bit less than 3 hours.   I tried burning a DVD with these, audio-files-only.  I checked lowest quality video, used no video, and got an Export To DVD error that I had "insufficient" space on the 4.7 GB disc!  So, I used the two latter files, which added to only 1.884 GB.  Premiere did not baulk, and it successfully burned a DVD that played.  Then I added the 1.599 GB file, and, once again, it produced an error.  This was clearly not going to work.
    At this point, I realized that Audition had done what it liked to do: It had saved the 16 bit-48 kHz files as 32 bit-48 kHz!  So, I went back to Audition and used EDIT to change the files to genuine 16 bit-48 kHz files.  When I opened them in Premiere, Premiere reported 16 bit-48 kHz files.  Their sizes were now, 0.799, 0.456, and 0.487 GB.  Please note that this totals 1.742 GB.  This is less than the 1.884 GB I had successfully used before.   Once again, I was getting the "insufficient" space error.
    I searched the CS2 Premiere manual and its index, but cannot really find any way to calculate maximum times, or squeezing the most out.  So, anybody got some ideas?
    Mike

    When working from DVD-Videos, this ARTICLE might be helpful - All VOB's (the container for the MPEG-2 files in a DVD-Video) are not created equally.
    Most DVR's write a VOB 01, that is not up to the DVD-specs. That can create a problem for PrE (and also PrPro), and if you have issues, please do follow Neale's advice.
    Good luck and welcome to the forum.
    Hunt

  • [k9copy] Backup of DVD Progress Stuck

    Source: DVD(-5) Movie
    Backup: Rip and Encode to Defaults (avi)
    During the rip:
    *** libdvdread: CHECK_VALUE failed in /home/giovanni/Desktop/svn-packages/k9copy/trunk/src/k9copy-2.3.3-Source/src/dvdread/nav_read.c:207 ***
    *** for dsi->dsi_gi.zero1 == 0 ***
    I don't know who this giovanni is, so it's surprising why a program is referencing a path which doesn't exist. And also this comes up randomly:
    DTS, flags=128"
    "First video packet in sequence starting at 799004686 misses PTS or DTS, flags=128"
    "First video packet in sequence starting at 799012878 misses PTS or DTS, flags=128"
    (repeated a lot of times)
    And then finally, at 76%:
    QWaitCondition: cv destroy failure:
    QWaitCondition: mutex destroy failure:
    QThread: Destroyed while thread is still running
    The app does not abort. Instead, the elapsed time keeps increasing. Without starting from terminal, there's no way to tell if anything's going on because CPU usage remains the same.
    On another note, using acetoneiso2 happens to "complete" the rip (the errors are still there because it's from libdvdread), in that it successfully finishes the process. But, the final result is only half of the DVD, i.e faulty rip. DVD length is 58mins, but the file is 24 and stops abruptly.
    It may be worth mentioning that the DVD appears to have two exact same tracks.

    It's telling you that you need to make a table of contents (-t). Try this without the *.VOB:
    dvdauthor -o /storage2/dvdcopy/ -T
    --EDIT--
    EEEEK! I told a lie. -t is the title, -T is the table of contents. The table of contents may have been created in the step you did before this. Take a look at the following page:
    http://da.gentoo-wiki.com/HOWTO_Create_a_DVD:Filesystem
    and for any other questions, check the links on the above's referring page:
    http://da.gentoo-wiki.com/Index:HOWTO_Create_a_DVD
    Last edited by skottish (2008-09-21 01:56:01)

  • Ejects dvd with a minute left

    I am having trouble with iDVD, I have made dvds before with it and they have worked just fine. Recently I have started trying to make dvds of greater length onto a DVD R+ DL. I select that option within the project info menu, and also select the professional quality option in encoding menu because the dvd length is greater than 120 min. Everything seems to work fine until I get to the multiplexing of the dvd and then with about a minute left, it ejects the dvd before stating that its done. However, once, when I tried to burn, it did appear to be completely done, however, the dvd wouldn't play on my computer or in my dvd player. Any help?

    I am having a similar issue, though instead of ejecting the DVD, iDVD crashes and then restarts. During the burning process, iDVD gets through the "Prepare, Process Menus, Process Slideshows" steps. Proceeds to "Process Movies" step, where it gets about as far as "encoding audio" before skipping to the "Burn" phase, where iDVD promptly crashes.
    I've never had a problem with this before; have burned many iMovie projects before. I picked up DVD+R discs for the first time, and switched back to DVD-R thinking that might be the issue.
    I've deleted the iDVD prefs file, and repaired permissions. Nothing works.
    Is this a similar issue, or should I be opening a new thread for this?

  • Settings for 1 DVD with 2 movies

    I would like to put 2 movies on one DVD using FCP, compressor & DVD SP (in that order). One movie is 39 minutes and the other is 87. Total minutes: 126
    When compressing my QT export from FCP and choosing my settings in Compressor 2, do I choose DVD:Best quality 150 for each movie or DVD Best Quality 90 for each movie. I just need to know if I choose my settings based on my target total DVD length or the target length of each movie on the DVD.
    AND why is that when I choose 150 minutes there is a little tag under the quality tab in the inspector box that states: Allows up to 118 minutes of video on a DVD-S I thought I chose 150?

    Hi:
    You must take in account the total lenght in minutes to fit in your disc to choose the encoding preset: 126 min.
    The key factor is encoding your audio to Dolby 2.0 (AC3). Thet will give you a smaller audio file and let you use more bitrate with your video. Using the original AIFF/PCM audio mot probably will give you some high bitrate error during building and/or playback errors in DVD players.
    You can try using the 120 min MPEG2 preset; you are close to that lenght and "probably" the final files fit in the DVD-5.
    If it doesn't , use the 150 min settings.
    Hope it helps !
      Alberto

  • Inventory Program 2

    I need some serious help and I'd appreciate anyone who knows Java. Here is the assignment:
    Modify the Inventory Program so the application can handle multiple items. Use an array to store the items. The output should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the output should display the value of the entire inventory.
    *?h Create a method to calculate the value of the entire inventory.*
    *?h Create another method to sort the array items by the name of the product.*
    *?h Post as an attachment in java forma*
    I have not completed the program so I am not sure what kind of errors I will get. For some reason I cannot get past the first part of code. The errors are in bold print. The error for "new DVD(....) reads "cannot find symbol". The System.out.println("...") error reads "cannot find symbol..symbol: method getDVDPrice()...location: class inventoryprogram1app.DVD[]...operator + cannot be applied to java.lang.String,Arrray.getDVDPrice. I think that most of the bottom half is ok because I have no errors here, it's just the top part that I cant get past. Any help would be appreciated. Thanks.
    public class InventoryProgram1App
    public static void main(String[] args)
    DVD[]dvd =new DVD[10];
    new *DVD*("We Were Soilders","5","19.99","278");
    new *DVD*("Why Did I Get Married","3","15.99","142");
    new *DVD*("I Am Legend","9","19.99","456");
    new *DVD*("Transformers","4","19.99","336");
    new *DVD*("No Country For Old Men","4","16.99","198");
    new *DVD*("The Kingdom","6","15.99","243");
    new *DVD*("Eagle Eye","2","16.99","681");
    new *DVD*("The Day After Tomorrow","4","19.99","713");
    new *DVD*("Dead Presidents","3","19.99","493");
    new *DVD*("Blood Diamond","7","19.99","356");
    *System.out.println("DVD Title:" +DVD.getdvdTitle());+*
    *+System.out.println("DVD Price:"+ dvd.getDVDPrice());*
    *System.out.println("DVD units in stock:" +dvd.getDVDStock());+*
    *+System.out.println("DVD item number:"+ dvd.getDVDitemNumber());*
    *for (int counter = 0; > DVD.length; counter++);*
    class DVD
    private int dvdTitle;
    private double dvdPrice;
    private double dvdStock;
    private double dvditemNumber;
    public DVD(int title, double price, double stock, double itemNumber)
    this.dvdTitle = title;
    this.dvdPrice = price;
    this.dvdStock = stock;
    this.dvditemNumber = itemNumber;
    public void setDVDTitle(int title)
    this.dvdTitle = title;
    public int getdvdDTitle()
    return dvdTitle;
    public void setDVDPrice(double price)
    this.dvdPrice = price;
    public double getDVDPrice()
    return dvdPrice;
    public void setDVDStock(double stock)
    this.dvdStock = stock;
    public double getDVDStock()
    return dvdStock;
    public void setDVDitemNumber(double itemNumber)
    this.dvditemNumber = itemNumber;
    public double getDVDitemNumber()
    return dvditemNumber;
    public double getValue()
    return this.dvdStock * this.dvdPrice;
    }

    I really appreciate you helping me out with this. I looked at all of the replies and went back and changed what was suggested. I have a load of errors...(*java.lang.ClassFormatError: Method "<error>" in class inventoryprogram2app/InventoryProgram2App has illegal signature "Ljava/lang/Object;"*
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: inventoryprogram2app.InventoryProgram2App.  Program will exit.
    Exception in thread "main"
    Exception in thread "main" Java Result: 1
    BUILD SUCCESSFUL (total time: 0 seconds)
    I am still working on the program and trying to correct the errors, but when I correct 1 or 2 errors lines that were not errors at first became errors. I've been working on this since last night and can't for the life of me figure out what I am doing wrong. The code is not completed because I am trying to correct the current errors. I did run the program to get the error messages. I would appreciate any advice on what I am doing wrong. Thanks in advance.
    public class InventoryProgram2App
        public static void main(String[] args)
            private DVD[]dvd =new DVD[10];
                Scanner input = new Scanner(System.in);
                String dvdTitle;
                double dvdPrice = 0.0;
                double dvdStock = 0.0;
                double dvditemNumber = 0.0;
                *dvd = new DVD();*
                *System.out.println("DVD Title: " + dvd.getDVDTitle());*
                *System.out.println("DVD Price:" + dvd.getDVDPrice());*
                *System.out.println("DVD units in stock:" + dvd.getDVDStock());*
                *System.out.println("DVD item number:" + dvd.getDVDitemNumber());*
                *System.out.println("DVD inventory value:" + dvd.getValue());*
    class DVD
        private String dvdTitle;
        private double dvdPrice;
        private double dvdStock;
        private double dvditemNumber;
         public DVD(String title, double price, double stock, double itemNumber)
            this.dvdTitle = title;
            this.dvdPrice = price;
            this.dvdStock = stock;
            this.dvditemNumber = itemNumber;
         public void setdvdTitle(String dvdTitle)
             *dvdTitle = dvdTitle;*
                *dvd[0] = new DVD("We Were Soilders","5","19.99","278");*
                *dvd[1] = new DVD("Why Did I Get Married","3","15.99","142");*
                *dvd[2] = new DVD("I Am Legend","9","19.99","456");*
                *dvd[3] = new DVD("Transformers","4","19.99","336");*
                *dvd[4] = new DVD("No Country For Old Men","4","16.99","198");*
                *dvd[5] = new DVD("The Kingdom","6","15.99","243");*
                *dvd[6] = new DVD("Eagle Eye","2","16.99","681");*
                *dvd[7] = new DVD("The Day After Tomorrow","4","19.99","713");*
                *dvd[8] = new DVD("Dead Presidents","3","19.99","493");*
                *dvd[9] = new DVD("Blood Diamond","7","19.99","356");*            }
         public void setdvdStock(int dvdStock)
            int stock = 0;
            if(dvdStock >= 0)
                dvdStock = stock;
            *else(dvdStock = 0)*     }
         public void setdvdPrice(double dvdPrice)
            double price;
            *if(dvdPrice = 0.0)*
                 price = dvdPrice;
             *else(price = 0.0)*
        public void setDVDTitle(String title)
            this.dvdTitle = title;
        public String getDVDTitle()
            return dvdTitle;
        public void setDVDPrice(double price)
            this.dvdPrice = price;
        public double getDVDPrice()
            return dvdPrice;
        public void setDVDStock(double stock)
            this.dvdStock = stock;
        public double getDVDStock()
            return dvdStock;
        public void setDVDitemNumber(double itemNumber)
            this.dvditemNumber = itemNumber;
        public double getDVDitemNumber()
            return dvditemNumber;
        public double getValue()
            return this.dvdStock * this.dvdPrice;
    class inventoryDVD
        int[] dvdValue = new int[10];
        for (int dvdS = 0;counter < DVD.length(); counter++);
        *dvdPrice * dvdStock[counter];*
        public String toString;
    }

  • Programming assistance

    Hi all,
    I need some help hopefully before Sun evening... I have to modify my Inventory program to have an Add, Delete and a search button simple enough.. Well Im new to Java programming and have been limping my way along from day one I have a C+ and need a C- so a little leeway.
    Could any one assist me on the easiest way to accomplish the task above even if it is just the search button that I get help with its better then nothing... So My DVDGUI looks like this;
    //DVDGUI.java
    import java.util.Arrays;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.ImageIcon;
    public class DVDGUI extends JFrame
    //Private Variables
    private GridBagLayout layout = new GridBagLayout();
    private GridBagConstraints constraints = new GridBagConstraints();
    //Private data from prior assignments
         private DVD [] dvd;
         private int index;
    // Labels
    private JLabel logoLabel;
    private JLabel nameLabel;
    private JLabel idLabel;
    private JLabel titleLabel;
    private JLabel unitsLabel;
    private JLabel priceLabel;
    private JLabel valueLabel;
    private JLabel feeLabel;
    private JLabel totalLabel;
    // Text Fields for displaying or editing
    private JTextField nameText;
    private JTextField idText;
    private JTextField titleText;
    private JTextField unitsText;
    private JTextField priceText;
    private JTextField valueText;
    private JTextField feeText;
    private JTextField totalText;
    private JTextField searchText;
    //Buttons
    private JButton firstButton; //To move to first element in the array
    private JButton nextButton; //To move to next element in the array
    private JButton previousButton; //To again move to next element in the array
    private JButton lastButton; //To move again to first element in the array
    private JButton addButton; //To add a DVD to array
    private JButton deleteButton; //To delete a DVD from array
    private JButton modifyButton; //To modify an element
    private JButton saveButton; //To save the array
    private JButton searchButton; //To search the array
    //Constatnts
    private final static int LOGO_WIDTH = 4;
    private final static int LOGO_HEIGHT = 4;
    private final static int LABEL_HEIGHT = 1;
    private final static int LABEL_WIDTH = 1;
    private final static int TEXT_HEIGHT = 1;
    private final static int TEXT_WIDTH = LOGO_WIDTH - LABEL_WIDTH;
    private final static int BUTTON_HEIGHT = 1;
    private final static int BUTTON_WIDTH = 1;
    private final static int LABEL_START_ROW = LOGO_HEIGHT + LABEL_WIDTH + 1;
    private final static int LABEL_COLUMN = 0;
    private final static int TEXT_START_ROW = LABEL_START_ROW;
    private final static int TEXT_COLUMN = LABEL_WIDTH + 1;
    private final static int BUTTON_START_ROW = LABEL_START_ROW + 9*LABEL_HEIGHT;
    private final static int BUTTON_COLUMN = LABEL_COLUMN;
    private final static int SEARCH_START_ROW = BUTTON_START_ROW + 3;
    final static String EMPTY_ARRAY_MESSAGE = "Hit ADD to add a new DVD";
    //Constants
    private final static int FRAME_WIDTH = 325;//460
    private final static int FRAME_LENGTH = 350;//343
    private final static int FRAME_XLOC = 250;
    private final static int FRAME_YLOC = 100;
         //Constructors
    //Initialization constructor
         public DVDGUI( DVD dvdIn[] )
         //Pass the frame title to JFrame, set the IconImage
              super( "DVD Inventory" );
    setLayout( layout );
    //Copy the input array (dvdIn)
              setDVDArray( dvdIn );
    //Start the display with the first element of the array
              index = 0;
    //Build the GUI
    buildGUI();
    //Values
    updateAllTextFields();
         }//End constructor DVDGUI
    //Methods
    //Copy an input DVD array to the GUI's private DVD array variable
         private void setDVDArray( DVD dvdIn[] )
              dvd = new DVD[dvdIn.length];
              for(int i = 0;i < dvd.length;i++)
              //Create a DVD array element from the input array
                   dvd[i] = new DVD( dvdIn[i] );
    /*               dvd[i] = new DVD( dvdIn.title(), dvdIn[i].productNumber(),
                   dvdIn[i].productUnitsInStock(), dvdIn[i].productPrice()
    //System.out.println( dvdIn[i].toString() );
              }//End for
         }//End copyArray
    //A method for updating each of the GUI fields
         private void updateAllTextFields()
    if ( dvd.length > 0 ) //Then update the JTextField display
    //Update the product name text field
    nameText.setText( dvd[index].productName() );
    //Update the product id text field
    idText.setText( String.format( "%d", dvd[index].productNumber() ) );
         //Update the title text field
              titleText.setText( dvd[index].title() );
    //Update the units in stock text field
              unitsText.setText( String.format( "%d", dvd[index].productUnitsInStock() ) );
         //Update the price text field
              priceText.setText( String.format( "$%.2f" , dvd[index].productPrice() ));
    //Update the stock value text field
              valueText.setText( String.format( "$%.2f" , dvd[index].productValue() ));
    //Update the restocking fee text field
              feeText.setText( String.format( "$%.2f" , dvd[index].restockingFee() ));
    //Update the total value text field
              totalText.setText( String.format( "$%.2f" , DVD.productValue( dvd ) ));
    }//End if
    else //Put a special message in the fields
    //Update the product name text field
    nameText.setText( EMPTY_ARRAY_MESSAGE );
    //Update the product id text field
    idText.setText( EMPTY_ARRAY_MESSAGE );
         //Update the title text field
              titleText.setText( EMPTY_ARRAY_MESSAGE );
         //Update the units in stock text field
              unitsText.setText( EMPTY_ARRAY_MESSAGE );
         //Update the price text field
              priceText.setText( EMPTY_ARRAY_MESSAGE );
    //Update the stock value text field
              valueText.setText( EMPTY_ARRAY_MESSAGE );
    //Update the restocking fee text field
              feeText.setText( EMPTY_ARRAY_MESSAGE );
    //Update the total value text field
              totalText.setText( EMPTY_ARRAY_MESSAGE );
    }//End else
         }//End updateAllTextFields
    //Set the appropriate fields editable or uneditable
    private void setModifiableTextFieldsEnabled( Boolean state )
    //The DVD ID, title, units in stock, and price can all be set editable or uneditable
    idText.setEditable( state );
    titleText.setEditable( state );
    unitsText.setEditable( state );
    priceText.setEditable( state );
    }//End setModifiableTextFieldsEnabled
    //Button Handler Class - Handling Methods
    private class ButtonHandler implements ActionListener
         public void actionPerformed(ActionEvent event)
    if( event.getSource() == firstButton ) //First is pressed
              handleFirstButton();
    }//End if
    else if( event.getSource() == previousButton ) //Previous is pressed
              handlePreviousButton();
    }//End else if
    else if( event.getSource() == nextButton ) //Next button is pressed
              handleNextButton();
    }//End else if
    else if( event.getSource() == lastButton ) //Last button is pressed
              handleLastButton();
    }//End else if
         else if (event.getSource() == firstButton)
              handleFirstButton();
         }//end else if
    }//End method actionPerformed
         }//End class ButtonHandler
    //Display the first element of the DVD array
    private void handleFirstButton()
         //Set the index to the first element in the array
    index = 0;
    //Update and disable modification
              updateAllTextFields();
    setModifiableTextFieldsEnabled( false );
    }//End method handleFirstButton
    //Display the next element of the DVD array or wrap to the first
    private void handleNextButton()
         //Increment the index
         index++;
    //If index exceeds the last valid array element, wrap around to the first element of the array
    if ( index > dvd.length - 1 )
    index = 0;
    }//End if
    //Update and disable modification
              updateAllTextFields();
    setModifiableTextFieldsEnabled( false );
    }//End method handleNextButton
    private void handlePreviousButton()
         index--;
         if ( index < 0)
              index = dvd.length - 1;
         }// End if
         //Update and disable modification
              updateAllTextFields();
    setModifiableTextFieldsEnabled( false );
    }//End method handlePreviousButton
    private void handleLastButton()
         index--;
         if ( index < dvd.length - 1 )
              index = 2;
         }//End if
         //Update and disable modification
              updateAllTextFields();
    setModifiableTextFieldsEnabled( false );
    }//End method handleLastButton
    //TextField Handler Class - Handling Methods
    //The class for handling the events for the buttons
    //NOTE: You don't need this for Week Eight, but I'm including it for motivation on Week
    //Nine's assignment
    //Hope you dont mind me leaving thin in there
    private class TextFieldHandler implements ActionListener
    public void actionPerformed( ActionEvent event )
    //User pressed Enter in JTextField titleText
    if ( event.getSource() == idText )
    //handleIdTextField();
    }//End if
    //User pressed Enter in JTextField titleText
    else if ( event.getSource() == titleText )
    //handleTitleTextField();
    }//End else if
    //User pressed Enter in JTextField unitsText
    else if ( event.getSource() == unitsText )
    //handleUnitsTextField();
    }//End else if
    //User pressed Enter in JTextField priceText
    else if ( event.getSource() == priceText )
    //handlePriceTextField();
    }//End else if
    //User pressed Enter in JTextField searchText
    else if ( event.getSource() == searchText )
    //handleSearchButtonOrTextField();
    }//End else if
    }//End method actionPerformed
    }//End inner class TextFieldHandler
    //GUI Methods
    //Build GUI
    private void buildGUI()
    //Add the logo
    buildLogo();
    //Add the text fields and their labels
    buildLabels();
    buildTextFields();
    //Add the navigation and other buttons
    buildMainButtons();
    //Give some values to the fields
    updateAllTextFields();
    //Set some of the frame properties
              setSize( FRAME_LENGTH , FRAME_WIDTH );
              setLocation( FRAME_XLOC , FRAME_YLOC );
              setResizable( false );
              //pack();
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              setVisible( true );
    }//End buildGUI()
    //Add the logo to the JFrame
    private void buildLogo()
    constraints.weightx = 2;
    constraints.weighty = 1;
    logoLabel = new JLabel( new ImageIcon( "shamrock.jpg" ) );
    logoLabel.setText( "Lucky DVDs" );
    constraints.fill = GridBagConstraints.BOTH;
    addToGridBag( logoLabel, 2, 2, LOGO_WIDTH, LOGO_HEIGHT );
    //Create a vertical space
    addToGridBag( new JLabel( "" ), LOGO_HEIGHT + 1, 0, LOGO_WIDTH, LABEL_WIDTH );
    }//End method buildLogo
    //Build just the panel containing the text
    private void buildLabels()
    //Variables (for readability)
    int row = 0;
    int column = 0;
    int width = 0;
    int height = 0;
    column = LABEL_COLUMN;
    width = LABEL_WIDTH;
    height = LABEL_HEIGHT;
    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.BOTH;
    //Create the name label and name text field
    nameLabel = new JLabel( "Product: " );
    nameLabel.setLabelFor( nameText );
    row = LABEL_START_ROW;
    addToGridBag( nameLabel, row, column, width, height);
    //Create the id label and id text field
    idLabel = new JLabel( "Product Id: " );
    idLabel.setLabelFor( idText );
    row += LABEL_HEIGHT;
    addToGridBag( idLabel, row, column, width, height);
    //Create the DVD title label and DVD title text field
    titleLabel = new JLabel( "Title: " );
    titleLabel.setLabelFor( titleText );
    row += LABEL_HEIGHT;
    addToGridBag( titleLabel, row, column, width, height);
    //Create the units in stock label and units in stock text field
              unitsLabel = new JLabel( "Units in Stock: " );
    unitsLabel.setLabelFor( unitsText );
    row += LABEL_HEIGHT;
    addToGridBag( unitsLabel, row, column, width, height);
    //Create the price label and price text field
              priceLabel = new JLabel( "Unit Price:" );
    priceLabel.setLabelFor( priceText );
    row += LABEL_HEIGHT;
    addToGridBag( priceLabel, row, column, width, height);
    //Create the value label and value text field
              valueLabel = new JLabel( "Product Value:" );
    valueLabel.setLabelFor( valueText );
    row += LABEL_HEIGHT;
    addToGridBag( valueLabel, row, column, width, height);
    //Create the fee label and fee text field
              feeLabel = new JLabel( "Restocking fee:" );
    feeLabel.setLabelFor( feeText );
    row += LABEL_HEIGHT;
    addToGridBag( feeLabel, row, column, width, height);
         //Create a vertical space
    row += LABEL_HEIGHT;
    addToGridBag( new JLabel( "" ), row, column, width, height );
    //Create the total value label and total value text field
              totalLabel = new JLabel( "Inventory Value:" );
    totalLabel.setLabelFor( totalText );
    row += LABEL_HEIGHT;
    addToGridBag( totalLabel, row, column, width, height);
    }//End method buildLabels()
    //Build containing textFields
    private void buildTextFields()
    //Variables
    int row = 0;
    int column = 0;
    int width = 0;
    int height = 0;
    column = TEXT_COLUMN;
    width = TEXT_WIDTH;
    height = TEXT_HEIGHT;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1;
    TextFieldHandler handler = new TextFieldHandler();
    nameText = new JTextField( "DVD" );
              nameText.setEditable( false );
    row = TEXT_START_ROW;
    addToGridBag( nameText, row , column, width, height );
    idText = new JTextField( "" );
              idText.setEditable( false );
    row += TEXT_HEIGHT;
    addToGridBag( idText, row , column, width, height );
    titleText = new JTextField( " " );
    titleText.addActionListener( handler );
              titleText.setEditable( false );
    row += TEXT_HEIGHT;
    addToGridBag( titleText, row , column, width, height );
    unitsText = new JTextField( " " );
    unitsText.addActionListener( handler );
              unitsText.setEditable( false );
    row += TEXT_HEIGHT;
    addToGridBag( unitsText, row , column, width, height );
    priceText = new JTextField( " " );
    priceText.addActionListener( handler );
              priceText.setEditable( false );
    row += TEXT_HEIGHT;
    addToGridBag( priceText, row , column, width, height );
    valueText = new JTextField( " " );
              valueText.setEditable( false );
    row += TEXT_HEIGHT;
    addToGridBag( valueText, row , column, width, height );
    feeText = new JTextField( " " );
              feeText.setEditable( false );
    row += TEXT_HEIGHT;
    addToGridBag( feeText, row , column, width, height );
    //Create a vertical space
    row += TEXT_HEIGHT;
    addToGridBag( new JLabel( " " ), row, column, width, height );
    totalText = new JTextField( "" );
              totalText.setEditable( false );
    row += TEXT_HEIGHT;
    addToGridBag( totalText, row , column, width, height );
    }//End method buildTextFields
    //Add the main buttons to the frame
    private void buildMainButtons()
    //Variables
    int row = 0;
    int column = 0;
    int width = 0;
    int height = 0;
    row = BUTTON_START_ROW;
    column = BUTTON_COLUMN;
    width = BUTTON_WIDTH;
    height = BUTTON_HEIGHT;
    constraints.weightx = 1;
    constraints.weighty = 0;
    //constraints.fill = GridBagConstraints.HORIZONTAL;
    ButtonHandler handler = new ButtonHandler();
    //Create a vertical space
    addToGridBag( new JLabel( "" ), row, 0, LOGO_WIDTH, LABEL_HEIGHT );
    firstButton = new JButton( "First" );
    firstButton.addActionListener( handler );
    row += LABEL_HEIGHT;
    addToGridBag( firstButton, row, column, width, height );
    previousButton = new JButton( "Previous" );
    previousButton.addActionListener( handler );
    column += BUTTON_WIDTH;
    addToGridBag( previousButton, row, column, width, height );
    nextButton = new JButton( "Next" );
    nextButton.addActionListener( handler );
    column += BUTTON_WIDTH;
    addToGridBag( nextButton, row, column, width, height );
    lastButton = new JButton( "Last" );
    lastButton.addActionListener( handler );
    column += BUTTON_WIDTH;
    addToGridBag( lastButton, row, column, width, height );
    }//End method buildMainButtons
    //Add a component to the grid bag
    // See Chapter 22, pp 1037 - 1046, Deital & Deital
    private void addToGridBag( Component component, int row, int column, int width, int height )
    //Set the upper-left corner of the component (gridx, gridy)
    constraints.gridx = column;
    constraints.gridy = row;
    //Set the number of rows and columns the componenet occupies
    constraints.gridwidth = width;
    constraints.gridheight = height;
    //Set the constraints
    layout.setConstraints( component, constraints );
    //Add the component to the JFrame
    add( component );
    }//End method addToGridBag
    } //End class DVDGUI
    Another thing is I have no idea where in this big list of code I need to write more code in order for the buttons to work. I was able to add buttons but they did nothing so I took them out. If anyone can help out that would be fantastic, if not its cool I will just do the best I can and get a second job to repay to take the class again :) No pressure right! Also please know Im not trying to have you all do my work, I just need guidence on where in this mess of text where I need to add more text.
    Thanks!
    Message was edited by: Me
    Greenbeer4me

    DvdRental class
    public class DvdRental {
         private String title;
         private int units;
         private double price;
         private String advisory;
         public DvdRental(String title, int units, double price
                   , String advisory) {
              this.title = title;
              this.units = units;
              this.price = price;
              this.advisory = advisory;
         public void setTitle(String dvdTitle) {
              title = dvdTitle;
         public void setUnits(int dvdUnits) {
              units = dvdUnits;
         public void setPrice(double dvdPrice) {
              price = dvdPrice;
         public void setAdvisory(String dvdAdvisory) {
              advisory = dvdAdvisory;
         public String getTitle() {
              return title;
         public int getUnits() {
              return units;
         public double getPrice() {
              return price;
         public String getAdvisory() {
              return advisory;
    }DvdList class
    import java.util.*;
    import javax.swing.*;
    public class DvdList extends AbstractListModel{
         private SortedSet model;
         public DvdList() {
              model = new TreeSet();
         public void add(DvdRental b) {
              model.add(b);
              fireContentsChanged(this,0,getSize());
         public void remove(DvdRental b) {
              model.remove(b);
              fireContentsChanged(this,0,getSize());
         public int getSize() {
              return model.size();
         public Object getElementAt(int index) {
              return model.toArray()[index];
         public void clear() {
              model.clear();
         public boolean contains(Object element) {
              return model.contains(element);
         public DvdRental find(String title) {
              for(DvdRental a : model) {
                   if(a.getTitle().equals(title))
                        return a;
              return null;
    }Now the swing part is left

  • Lookingfor help displaying GUI's

    I am trying to add buttons to my inventory program and everything complies but the screen comes up and is blank. Can someone point me in the right direction please?
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.*;
    public class InventoryButtons extends JFrame
         private JTextField jtfTitle;
        private JTextField jtfItem;
        private JTextField jtfUnits;
        private JTextField jtfPrice;
        private JTextField jtfRestock;
        private JTextField jtfValue;
        private JTextField jtfValueAll;
         static int dispMov = 0;
              int i;
              double total = 0;
              final Movies[]DVDs = new Movies[4];
              for (i = 0; i<4; i++)
            for(int index = 0; index < DVDs.length; index++)
                   DVDs[0] = new Movies("Raiders of the Lost Ark", "189", 15, 12.99, "PG-13");
                   DVDs[1] = new Movies("Revenge of the Sith", "222", 4, 10.99, "R");
                   DVDs[2] = new Movies("Toy Story", "325", 11, 15.95, "G");
                   DVDs[3] = new Movies("Memento", "456", 30, 14.00, "R");
            JPanel jpLabels = new JPanel();
              jpLabels.setLayout(new GridLayout(8,1));
              jpLabels.add(new JLabel(" DVD Title:"));
              jpLabels.add(new JLabel(" Item #"));
              jpLabels.add(new JLabel(" Units in Stock:"));
              jpLabels.add(new JLabel(" Price:"));
              jpLabels.add(new JLabel(" Restocking Fee (5%):"));
              jpLabels.add(new JLabel(" Total Value of Inventory:"));
              jpLabels.add(new JLabel(" Value of All Inventory:"));
            JPanel jpTextFields = new JPanel();
              jpTextFields.setLayout(new GridLayout(8,1));
              jpTextFields.add(jtfTitle = new JFormattedTextField());
              jpTextFields.add(jtfItem = new JFormattedTextField());
              jpTextFields.add(jtfUnits = new JFormattedTextField());
              jpTextFields.add(jtfPrice = new JFormattedTextField());
              jpTextFields.add(jtfRestock = new JFormattedTextField());
              jpTextFields.add(jtfValue = new JFormattedTextField());
              jpTextFields.add(jtfValueAll = new JFormattedTextField());
            for(int j1=0; j1 < DVDs.length; ++j1)
                jtfTitle.setText(DVDs[j1].getDvdTitle());
                jtfItem.setText(DVDs[j1].getDvdItem());
                jtfUnits.setText(String.valueOf(DVDs[j1].getDvdStock()));
                jtfPrice.setText(String.valueOf(DVDs[j1].getDvdPrice()));
                jtfRestock.setText(String.valueOf(DVDs[j1].getRestockingFee()));
                jtfValue.setText(String.valueOf(DVDs[j1].inventoryValue()));
                jtfValueAll.setText(String.valueOf(DVDs[j1].CalculateTotalInventoryValue( DVDs)));
         public static void main(String args[])
                   InventoryButtons inventorybuttons = new InventoryButtons();
                   inventorybuttons.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
                   inventorybuttons.setSize(1100,300);
                   inventorybuttons.setVisible(true);
         class Inventory
               // instance fields
            private String dvdTitle;
            private String dvdItem;
            private double dvdStock;
            private double dvdPrice;
            //constructor to initialize DVD title, item, stock and price
            public Inventory(String title, String item, double stock, double price)
               dvdTitle = title;
               dvdItem = item;
               dvdStock = stock;
               dvdPrice = price;
            } // end class Inventory constructor
            // set DVD name
            public void setDvdTitle(String title)
               dvdTitle = title;
            } // end method setDvdTitle
            // return DVD name
            public String getDvdTitle()
               return dvdTitle;
            } // end method getDvdTitle
            // set item number
            public void setDvdItem(String item)
               dvdItem = item;
            } // end method setDvdItem
            // return item number
            public String getDvdItem()
               return dvdItem;
            } // end method getDvdItem
            // set number of units in stock
            public void setDvdStock(double stock)
               dvdStock = stock;
            } // end method setDvdStock
            // return number of units in stock
            public double getDvdStock()
               return dvdStock;
            } // end method getDvdStock
            // set price of each unit
            public void setDvdPrice (double price)
               dvdPrice = price;
            } // end method setDvdPrice
            // return price of each unit
            public double getDvdPrice()
               return dvdPrice;
            } // end method getDvdPrice
            // calculate inventory value
            public double inventoryValue()
               return dvdPrice * dvdStock;
            } // end method inventoryValue
             //method to calculate total value of the inventory in an array of products
         public Double CalculateTotalInventoryValue(Inventory[] DVDs)
           Double total = 0.0;
           for(int index = 0; index < DVDs.length; index++)
            Inventory inv = DVDs[index];
            total += inv.inventoryValue();
           return total;
              //sort method
         //method to sort products based on product name
         public Inventory[] SortInventory(Inventory[] DVDs)
           Inventory tmp;
           for (int i = 0; i < DVDs.length; i++)
            for (int j = i + 1; j < DVDs.length; j++)
             String s1 = DVDs.getDvdTitle();
         String s2 = DVDs[j].getDvdTitle();
         if( s1.compareTo(s2) > 0)
         tmp = DVDs[i];
         DVDs[i] = DVDs[j];
         DVDs[j] = tmp;
         return DVDs;
         } // end class Inventory
         class Movies extends Inventory
              //instance field
              private String dvdRating;//DVD Rating
              private double RestockingFee;
              //five argument constructor
              public Movies(String title, String item, double stock, double price, String rating)
              super( title,item,stock,price);
              setDvdRating( rating ); // validate and store DVD rating
              } // end five-argument Movie constructor
              private void setDvdRating(String rating)
                   dvdRating = rating;
              } // end method setDvdRating
                   // return DVD rating
                   public String getDvdRating()
                   return dvdRating;
                   } // end method getDvdRating
                   public void setRestockingFee(double Fee)
                   RestockingFee = Fee;
                   }//end method setRestockingFee
                   public double getRestockingFee()
                        return super.getDvdPrice()*.05;
                   }//end method restocking fee
              // calculate total inventory
                   public double inventoryValue()
              return super.getDvdStock()*super.getDvdPrice() * 1.05;
                        // end class Movies

    Why is all that code not in your constructor? It should be in the constructor. Or some method.
    Anyway. You create a JFrame. You create a bunch of Panels. You add a bunch of stuff to the Panels. You never add the Panels to the frame.
    Fix the first thing I talked about (put the code in the constructor at least) and then add the panels to the frame.
    Edit: due to achieving binary zen this will probably be my last post for today. Good luck.

  • Inventory Program Part 3

    Hi. I'd like to thank all who replied to my Inventory 2 program. Today I am working on Inventory Program Part 3 and need a little help with this also.
    Assignment Description:
    CheckPoint: Inventory Program Part 3
    ?h Resource: Java: How to Program
    ?h Due Date: Day 7 [Individual] forum
    ?h Modify the Inventory Program by creating a subclass of the product class that uses one additional unique feature of the product you chose (for the DVDs subclass, you could use movie title, for example). In the subclass, create a method to calculate the value of the inventory of a product with the same name as the method previously created for the product class. The subclass method should also add a 5% restocking fee to the value of the inventory of that product.
    ?h Modify the output to display this additional feature you have chosen and the restocking fee.
    ?h Post as an attachment in java format.
    I think that I have most of the code correct, however I still have errors withing my code that I have changed around multiple times and still can't figure out how to correct the errors.
    Here is my code for Inventory Program Part 3:
    package inventoryprogram3;
    import java.util.Scanner;
    import java.util.ArrayList;
    public class InventoryProgram3
         * @param args the command line arguments
        public static void main(String[] args)
            Scanner input = new Scanner (System.in);
            DVD[] dvd = new DVD[10];
            dvd[0] = new DVD("We Were Soilders","5","19.99","278");
            dvd[1] = new DVD("Why Did I Get Married","3","15.99","142");
            dvd[2] = new DVD("I Am Legend","9","19.99","456");
            dvd[3] = new DVD("Transformers","4","19.99","336");
            dvd[4] = new DVD("No Country For Old Men","4","16.99","198");
            dvd[5] = new DVD("The Kingdom","6","15.99","243");
            dvd[6] = new DVD("Eagle Eye","2","16.99","681");
            dvd[7] = new DVD("The Day After Tomorrow","4","19.99","713");
            dvd[8] = new DVD("Dead Presidents","3","19.99","493");
            dvd[9] = new DVD("Blood Diamond","7","19.99","356");
            double dvdValue = 0.0;
                for (int counter = 0; > DVD.length ;counter++);
            System.out.printf("\nInventory value is: $%,2f\n",dvdValue);
    class DVD
        protected String dvdTitle;
        protected double dvdPrice;
        protected double dvdStock;
        protected double dvditemNumber;
         public DVD(String title, double price, double stock, double itemNumber)
            this.dvdTitle = title;
            this.dvdPrice = price;
            this.dvdStock = stock;
            this.dvditemNumber = itemNumber;
        DVD(String string, String string0, String string1, String string2) {
            throw new UnsupportedOperationException("Not yet implemented");
         public void setDVDTitle(String title)
            this.dvdTitle = title;
        public String getDVDTitle()
            return dvdTitle;
        public void setDVDPrice(double price)
            this.dvdPrice = price;
        public double getDVDPrice()
            return dvdPrice;
        public void setDVDStock(double stock)
            this.dvdStock = stock;
        public double getDVDStock()
            return dvdStock;
        public void setDVDitemNumber(double itemNumber)
            this.dvditemNumber = itemNumber;
        public double getDVDitemNumber()
            return dvditemNumber;
        public double getValue()
            return this.dvdStock * this.dvdPrice;
        System.out.println();
        *_System.out.println( "DVD Title:" + dvd.getDVDTitle());_*
        *_System.out.println("DVD Price:" + dvd.getDVDPrice());_*
        *_System.out.println("DVD units in stock:" + dvd.getDVDStock());_*    _System.out.println("DVD item number: " + dvd.getDVDitemNumber());_    System.out.printf("The total value of dvd inventory is: $%,.2f\n" ,_*dvdValue*_);
    class MovieGenre extends InventoryProgram3
        private String movieGenre;
        _*public movieGenre(String title, double price, double stock, double itemNumber, String movieGenre)_*
            *_super(dvdTitle, dvdPrice, dvdStock, dvditemNumber, dvdmovieTitle);_*
            *_movieGenre = genre;_    }*
        public void setmovieTitle(String title)
            this.movieGenre = _*genre*_;
        public String getmovieGenre()
            return _*moviegenre*_;
        public double getValue()
            return getValue() * 1.05;
        public double gerestockingFee()
            return getValue() * .05;
        public String toString(Object[] dvdValue)
            return String.format("%s %s\nTotal value of inventory is: %s", dvdValue);
    }I ran the program just to see the error messages:
    Exception in thread "main" java.lang.NoClassDefFoundError: inventoryprogram3/DVD (wrong name: inventoryprogram3/dvd)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at inventoryprogram3.InventoryProgram3.main(InventoryProgram3.java:20)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 0 seconds)
    I really don't understand what's going on here and would appreciate help from anyone who knows and understands Java.
    Thanks in advance.

    You say you "ran" it. I think you mean compiled it? The public class is InventoryProgram3, not DVD.
    If you did mean you tried to run it, then additionally, instead ofjava inventoryprogram3/InventoryProgram3
    Should be
    java inventoryprogram3.InventoryProgram3

  • Inventory Program Part 6 - Please Help

    My last assignment is due in about two hours and I am completely lost. I have been trying to figure out how to add functionality to my JButtons all week.
    I have added the following buttons but they do not work: save, delete, modify, save, search, add.
    I also need to add a company logo. I hope someone can please help me understand.
    Here is my current code:
    public class DVD {
         protected int itemNum;     // item number
         protected String name;     // item name
         protected int unit;          // number of units of the item
         protected double price;     // price of each unit
         public DVD() {}          // Default constructor
         public DVD(int itemNum, String name, int unit, double price) {
              // Constructor with input
              this.itemNum = itemNum;
              this.name = name;
              this.unit = unit;
              this.price = price;
         // Getter and Setter methods
         public void setItemNum(int itemNum) {
              this.itemNum = itemNum;
         public int getItemNum() {
              return itemNum;
         public void setName(String name) {
              this.name = name;
         public String getName() {
              return name;
         public void setUnit(int unit) {
              this.unit = unit;
         public int getUnit() {
              return unit;
         public void setPrice(double price) {
              this.price = price;
         public double getPrice() {
              return price;
         // Get the value of the inventory
         public double calculateInventory() {
              return unit * price;
         // Get the value of all inventory
         public static double calculateEntireInventory(DVD [] prod) {
              double sum = 0;
              for (int i = 0; i < prod.length; i++)
                   sum += prod.getUnit() * prod[i].getPrice();
              return sum;
         // Sort inventory by name
         public static Movie [] sortInventory(Movie [] prod) {
         boolean doMore = true;
    while (doMore) {
    doMore = false; // last pass over array
    for (int i=0; i<prod.length-1; i++) {
    if (prod[i].getName().compareTo(prod[i+1].getName()) > 0) {
    Movie temp = prod[i]; prod[i] = prod[i+1]; prod[i+1] = temp;
    doMore = true;
         return prod;
    public class Movie extends DVD{
         //instant variable
         protected String dvdTitle;
    public Movie(int itemNum, String name, int unit, double price, String dvdTitle) {
         super(itemNum, name, unit, price);
         this.dvdTitle = dvdTitle;
    public String getdvdTitle() {
              return dvdTitle;
         // Get the value of the inventory
         public double calculateInventory(DVD[] dvd) {
              double sum = 0;
              for (int i = 0; i < dvd.length; i++)
                   sum += 0.05* dvd[i].getUnit() * dvd[i].getPrice();
              return sum;
    public double calculateRestockFee(){
         return price*0.05;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.text.DecimalFormat;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    public class Inventory extends JApplet {
         private JLabel itemNumLabel = new JLabel("Item Number: ");
         private JTextField itemNum = new JTextField();
         private JLabel itemNameLabel = new JLabel("Category: ");
         private JTextField itemName = new JTextField();
         private JLabel unitLabel = new JLabel("Number of Units: ");
         private JTextField unit = new JTextField();
         private JLabel priceLabel = new JLabel("Unit Price: ");
         private JTextField price = new JTextField();
         private JLabel dvdTitleLabel = new JLabel("DVD Title: ");
         private JTextField dvdTitle = new JTextField();
         private JLabel rfLabel = new JLabel("Restocking Fee");
         private JTextField rfValue = new JTextField();
         private JLabel inventoryLabel = new JLabel("Inventory value: ");
         private JTextField inventoryValue = new JTextField();
         private JLabel totalValue = new JLabel();
         private JButton previous = new JButton("Previous");
         private JButton next = new JButton("Next");
         private JButton last = new JButton("Last");
         private JButton first = new JButton("First");
         private JButton add = new JButton("Add");
         private JButton delete = new JButton("Delete");
         private JButton modify = new JButton("Modify");
         private JButton save = new JButton("Save");
         private JButton search = new JButton("Search");
         private JLabel totalInventory = new JLabel();
         private Movie[] DVDArray = null;
         private int current = 0;
         private int total = 0;
         class ButtonListener implements ActionListener {
              public void actionPerformed(ActionEvent e) {
                   JButton button = (JButton) e.getSource();
                   if (button == previous) current = (current + total - 1) % total;
                   if (button == next) current = (current + 1) % total;
                   if (button == last) current = (current = 5) % total;
                   if (button == first) current = (current =0) % total;
                   if (button == modify) itemName.setVisible(true);
         private void display() {
              Movie movie = DVDArray[current];
              DecimalFormat df=new DecimalFormat("$#.00");
              itemNum.setText(movie.getItemNum()+""); itemNum.setEditable(false);
              itemName.setText(movie.getName()); itemName.setEditable(false);
              unit.setText(movie.getUnit()+""); unit.setEditable(false);
              price.setText(df.format(movie.getPrice())); price.setEditable(false);
              dvdTitle.setText(movie.getdvdTitle()); dvdTitle.setEditable(false);
              rfValue.setText(df.format(movie.calculateRestockFee())); rfValue.setEditable(false);
              inventoryValue.setText(df.format(movie.calculateInventory())); inventoryValue.setEditable(false);
              totalValue.setText("The total inventory value is " + df.format(DVD.calculateEntireInventory(DVDArray)));
         final JLabel label; // logo
    //JLabel constructor for logo
    Icon logo = new ImageIcon("C:/logo.jpg"); // load logo
    label = new JLabel(logo); // create logo label
    label.setToolTipText("Company Logo"); // create tooltip
         public void init() {
              DVDArray = new Movie [6];
              // Add DVD items into the list
              DVDArray[0] = new Movie (15, "Action", 65,12.00,"Frequency");
              DVDArray[1]= new Movie(33, "Comedy", 12, 21.00, "Norbit");
              DVDArray[2] = new Movie(13, "Disney",33,14.00,"Flubber");
              DVDArray[3] = new Movie(22, "Drama", 48, 18.00,"Citizens Kane");
              DVDArray[4] = new Movie(47, "Horror", 42, 19.00,"Pycho");
              DVDArray[5] = new Movie(26, "Sci-Fi", 27, 26.00,"The Abyss");
    total = 6;
    current = 0;
    ButtonListener buttonListener = new ButtonListener();
    previous.addActionListener(buttonListener);
    next.addActionListener(buttonListener);
    last.addActionListener(buttonListener);
    first.addActionListener(buttonListener);
    add.addActionListener(buttonListener);
    delete.addActionListener(buttonListener);
    modify.addActionListener(buttonListener);
    save.addActionListener(buttonListener);
    search.addActionListener(buttonListener);
    JPanel up = new JPanel();
    up.setLayout(new GridLayout(7,2));
    up.add(itemNumLabel); up.add(itemNum);
    up.add(itemNameLabel); up.add(itemName);
    up.add(dvdTitleLabel); up.add(dvdTitle);
    up.add(unitLabel); up.add(unit);
    up.add(priceLabel); up.add(price);
    up.add(rfLabel); up.add(rfValue);
    up.add(inventoryLabel); up.add(inventoryValue);
    display();
    JPanel middle = new JPanel();
    middle.setLayout(new FlowLayout());
    middle.add(previous); middle.add(next);middle.add(last);middle.add(first);
    middle.add(add);middle.add(delete);middle.add(modify);middle.add(search);
    middle.add(save);
    JPanel down = new JPanel();
    down.setLayout(new BorderLayout());
    down.add(BorderLayout.CENTER, totalValue);
    JPanel all = new JPanel();
    all.setLayout(new BoxLayout(all, BoxLayout.Y_AXIS));
    all.add(up);
    all.add(down);
    all.add(middle);
    Container cp = getContentPane();
    cp.add(BorderLayout.NORTH, all);
    public static void main(String args []) {
    JApplet applet = new Inventory();
    JFrame frame = new JFrame("DVD Inventory");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setResizable(false);
    Container cp=frame.getContentPane();
    cp.add(applet);
    frame.setSize(600,330);
    applet.init();
    frame.setVisible(true);
    // Icon logo = new ImageIcon(getResource( "logo.gif" ) );
    } //end main
    } // end class Inventory                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Your code has some good spots and some bad spots or problems, and I'll try to hit on some of the more obvious problems (the ones that I can see immediately) so that you can try to fix it.
    1) Your DVD class overall looks pretty good until we get to the end. The method public static double calculateEntireInventory(DVD[] prod) shouldn't be part of the DVD class since it has nothing to do with an individual DVD (which is what this class is all about) and everything to do with a collection of DVDs. You should move this to another class, a non-GUI Inventory class.
    2) The method public static Movie[] sortInventory(Movie[] prod) also shouldn't be in your DVD class for the same reason as noted above, and also because it deals with Movie objects which are objects that descend from DVD. The parent really shouldn't have to depend on the child class to function, and leaving this in would likely break your code at some time or another. Again, put this in a non-GUI Inventory class. You probably should use a DVD parameter, not a Movie parameter. Another option is to have your DVD and Movie classes implement the Comparable interface, since if you do this, sorting any collection of these is a breeze by using Arrays.sort(...) or Collections.sort(...).
    3) Again (starting to sound like a broken record) the method public double calculateInventory(DVD[] dvd) shouldn't be part of the Movie class for the very same reasons noted above.
    4) You need to create a non-GUI Inventory class, shoot, you can call it NonGuiInventory if you'd like (though I'd call it Inventory and call the GUI class GuiInventory) that has all the important functionality that the GUI will display. This class holds a collection of DVDs (or Movies), has an int index that points to the current Movie of interest, has a next() method that advances this index and returns the next Movie in the collection (or the first if you're at the last), has a previous() method that does the opposite, has a first() method that sets the index to zero and returns the first Movie in the collection, a last() method that advances the index to the size of the collection - 1 and returns this Movie, and has a sort method that sorts the collection. You can even have add(Movie) and a remove(Movie) methods here. By separating this functionality from the GUI, you are able to simplify your task by dividing and conquering.
    5) Finally you can display all this with your InventoryGUI class that uses the above class as its model, displaying the current Movie that is pointed to by the Inventory's index, that when the next() method is called gets the Movie returned by it and displays it.
    Note that if you go this route, you'll need to do some major re-writes of the GUI class, but it will improve your program greatly.
    HTH and good luck

  • How do I identify the maximum length of video in iMovie which can be made into a dvd in iDVD, please?

    How do I identify the maximum length of video in iMovie which can be made into a dvd in iDVD, please?
    I made a sellection of video clips  > pressed on "share" > on iDVD >  after one hour of formating the message was under "project duration"  : "Your project exceeds the maximum content duration. To burn your DVD, change the encoder setting in the Project Info window."
    I have edited out some of the clips and waited anothe hour or so bu the same message appeared !
    I want to know in advance how long can be the video clip sellection for the quality of video chosen ( the best before HD).
    please help if ou can.
    thank you very much indeed.
    Michael
    North London

    It's trying to tell you to change the encoding setting:
    iDVD encoding settings:
    http://docs.info.apple.com/article.html?path=iDVD/7.0/en/11417.html
    Short version:
    Best Performance is for videos of up to 60 minutes
    Best Quality is for videos of up to 120 minutes
    Professional Quality is also for up to 120 minutes but even higher quality (and takes much longer)
    That was for single-layer DVDs. Double these numbers for dual-layer DVDs.
    Professional Quality: The Professional Quality option uses advanced technology to encode your video, resulting in the best quality of video possible on your burned DVD. You can select this option regardless of your project’s duration (up to 2 hours of video for a single-layer disc and 4 hours for a double-layer disc). Because Professional Quality encoding is time-consuming (requiring about twice as much time to encode a project as the High Quality option, for example) choose it only if you are not concerned about the time taken.
    In both cases the maximum length includes titles, transitions and effects etc. Allow about 15 minutes for these.
    You can use the amount of video in your project as a rough determination of which method to choose. If your project has an hour or less of video (for a single-layer disc), choose Best Performance. If it has between 1 and 2 hours of video (for a single-layer disc), choose High Quality. If you want the best possible encoding quality for projects that are up to 2 hours (for a single-layer disc), choose Professional Quality. This option takes about twice as long as the High Quality option, so select it only if time is not an issue for you.
    Use the Capacity meter in the Project Info window (choose Project > Project Info) to determine how many minutes of video your project contains.
    NOTE: With the Best Performance setting, you can turn background encoding off by choosing Advanced > “Encode in Background.” The checkmark is removed to show it’s no longer selected. Turning off background encoding can help performance if your system seems sluggish.
    And whilst checking these settings in iDVD Preferences, make sure that the settings for NTSC/PAL and DV/DV Widescreen are also what you want.
    http://support.apple.com/kb/HT1502?viewlocale=en_US

  • Full length feature on FCP from mini-DV... benchmarking comparable DVD's

    After over a year of post production, we just completed a full length kids’ feature film shot on a DVX-100A and edited in FCP. The title is "The Bracelet of Bordeaux", and the movie info is on IMDb and our website. This was a large scale project, with almost 300 actors, 50 crew members and 18 interior/exterior locations. There were over 60 shooting days. It was shot on mini-DV due to budgetary considerations.
    The movie’s look-feel is exceptional, especially when viewed on a Mac HD screen and Sony NTSC monitor. However, when we first tested the movie in a theatre, playing a DVD through a high-end projection system, the quality was terrible. Ultimately, we achieved outstanding results by playing directly off the uncompressed FCP timeline through a Barco Hi Def projector and onto a 40-ft screen. We held a major theatrical test screening (3,000 people attended 10 shows), and the movie’s visual quality was stunningly good, receiving acclaim from audiences and critics. The results looked particularly film-like in the mid to back rows of the theatre (even numerous professional viewers thought that it was film). You can view audience comments and media reviews on IMDb.
    Now we are creating a DVD to send to film festivals and prospective distributors. Of course, we will not be able to determine the projection system used at the festivals and the movie will mostly be exhibited from a DVD. I would like to know what full length feature films are out there, which were shot on mini-DV (especially the DVX100 or 100A), and edited on FCP, so I can use them to benchmark our DVD results. I have been living in the edit dungeon for over 14 months and have not kept track of movies shot in mini-DV and editing on Macs. Also, please provide any observations about the cinematic quality of these films
    G5   Mac OS X (10.4.8)   FCP, DVDSP

    https://eww.pavc.panasonic.co.jp/pro-av/sales_o/04reports/2004webWW/WorldWideWW/ stuffsingaporeWW/stuffsingaporeWW.html
    this film was shot DV
    However I can't help feel you are about to embark on a wild goose chase.
    If you are going to distribute a movie on DVD for projection in multiple theatres with different equipment for screenings you will not attend I don't see what you hope to achieve.
    DVD is by nature a "standard" without too much room for manoeuvre if you are supplying what must effectively be labelled a consumer market. You will have to conform your movie to a bitrate which is sympathetic to all DVD players and not for example use a DVD9 and a higher bitrate for a DVD player you own and know will work.
    Cinematic quality is subjective also, which has a true film look The Sound of Music or The Matrix ? There are plenty of filters out there to give a film look and feel but to be honest the defining factor between film and video is often the quality of lighting, acting and camera work and not so much a blatant "look". It's audience acceptance of a piece in a theatre environment, which is a big help in the first place since we all associate the cinema with film (oh and adverts for the local tandoori).
    Your film will look inherently different to the competition and so it should . . don't compare it!

Maybe you are looking for

  • What is the best solution to create SharePoint Extranet Application for existing windows web application ?

    Hello, At present my SharePoint farm is having following domains: 1) Internal Domain - Domain1 2) External Trusted Domain - Domain2 And Following Intranet WebApplications having Windows Mode Authentication: 1) http://mywebapp1.Domain1.com - Single si

  • Movement Type 103 - 105

    Hi Gurus, In Purchase Order GR scenario, QM is active at M.Type 103 & Inspection Lot is generated. Once UD is done then with M. Type 105, material is sent to Unrestricted Use or Blocked Stock. Now after 103 M. Type, system allowing to do M. Type 105

  • Running BizTalk on multiple non-clustered servers. Potential serious issue

    Hi, I have just discovered what has potential to be a fairly large issue in our current BizTalk Architecture. We are running BizTalk Server 2006 R2 on 2 different servers, running Windows Server 2003 R2. These servers are NOT clustered. Instead, BizT

  • Raise_application_error in after-logon-trigger

    Hi, I try to build a after logon on database trigger, this should execute some inserts into an audit-table, and if some conditions are not given, I want the user to be disconnected. In this forum I found this thread with a trigger similar to my needs

  • XP Install with Raid Error

    We've got: 845E Max2 (MS-6398e) running 2x 60GB drives striped. When we try to install XP Pro, (pressing F6 & selecting the correct driver) we eventually get : Stop error 0x??7B It seems to be on the final reboot??? There is a CDRW & DVD on the stand