I have completed most of the code for my final assignment for my Java class but am having some difficulties getting it to compile. The requirements for the assignment are:

• Modify the Inventory Program to include an Add button, a Delete button, and a Modify
button on the GUI. These buttons should allow the user to perform the corresponding
actions on the item name, the number of units in stock, and the price of each unit. An
item added to the inventory should have an item number one more than the previous last
item.
• Add a Save button to the GUI that saves the inventory to a C:\data\inventory.dat file.
• Use exception handling to create the directory and file if necessary.
• Add a search button to the GUI that allows the user to search for an item in the inventory
by the product name. If the product is not found, the GUI should display an appropriate
message. If the product is found, the GUI should display that product’s information in the
GUI.

Here is my current code. Any help getting it to compile would be greatly appreciated!

*****************DVDMovie******************

import java.text.NumberFormat;

/**
 * 
 * @author
 */
// This is class is used to hold the product information for the inventory
// program
public class DVDMovie {

    // item number field
    private int itemNumber;

    // DVD title field
    private String dvdTitle;

    // number of units in stock
    private int unitsInStock;

    // price per unit from stock
    private double unitPrice;

    // DVD genre
    private String genre;

    // default no argument constructor
    public DVDMovie(int itemNumber, String dvdTitle, int unitsInStock, double unitPrice, String genre) {
        this.itemNumber = 0;
        this.dvdTitle = "unknown";
        this.unitsInStock = 0;
        this.unitPrice = 0;
        this.setGenre("unknown");
    }

        /**
     * Argument constructor to initialize the object with passed values
     * 
     * @param itemNumber
     * @param dvdTitle
     * @param unitsInStock
     * @param unitPrice
     */
    public DVDMovie(int itemNumber, String dvdTitle, int unitsInStock,
            double unitPrice) {
        this.itemNumber = itemNumber;
        this.dvdTitle = dvdTitle;
        this.unitsInStock = unitsInStock;
        this.unitPrice = unitPrice;
    }

    // calculates inventory value for this product
    public double getInventoryValue() {
        return unitPrice * unitsInStock;
    }

    //
    // Accessors and Mutator for Class fields
    //
    public int getItemNumber() {
        return itemNumber;
    }

    public void setItemNumber(int itemNumber) {
        this.itemNumber = itemNumber;
    }

    public String getDVDTitle() {
        return dvdTitle;
    }

    public void setDVDTitle(String DVDTitle) {
        this.dvdTitle = dvdTitle;
    }

    public int getUnitsInStock() {
        return unitsInStock;
    }

    public void setUnitsInStock(int unitsInStock) {
        this.unitsInStock = unitsInStock;
    }

    public double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(double unitPrice) {
        this.unitPrice = unitPrice;
    }

    public String toString() {
        NumberFormat formatter = NumberFormat.getCurrencyInstance();
        String str = "Number: " + getItemNumber();
        str += ", DVD Title: " + getDVDTitle();
        str += ", In Stock: " + getUnitsInStock();
        str += ", Unit Price: " + getUnitPrice() + "\n";
        str += "Inventory Value: " + formatter.format(getInventoryValue())
                + "\n";
        return str;
    }

    /**
     * @return the genre
     */
    public String getGenre() {
        return genre;
    }

    /**
     * @param genre the genre to set
     */
    public void setGenre(String genre) {
        this.genre = genre;
    }
}

*****************Inventory**************

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.text.NumberFormat;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author
 */
// This is the Driver program for Product
public class Inventory extends JFrame implements ActionListener {
    // Index of current element of array

    private int position = 0;
    // create Products array
    DVDMovie[] movieArray = null;
    // Various components that are used in the program
    private JLabel titleLabel = new JLabel("DVD Title: ");
    private JTextField titleText = new JTextField("");
    private JLabel itemNumberLabel = new JLabel("Item Number: ");
    private JTextField itemNumberText = new JTextField("");
    private JLabel unitsInStockLabel = new JLabel("Units In Stock: ");
    private JTextField unitsInStockText = new JTextField("");
    private JLabel unitPriceLabel = new JLabel("Unit Price: ");
    private JTextField unitPriceText = new JTextField("");
    private JLabel invValueLabel = new JLabel("Inventory Value: ");
    private JTextField invValueText = new JTextField("");
    // Product object related components
    private JLabel genreLabel = new JLabel("DVD Genre: ");
    private JTextField genreText = new JTextField("");
    private JLabel restockingFeeLabel = new JLabel("Restocking Fee: ");
    private JTextField restockingFeeText = new JTextField("");
    private JLabel totalInvValueLabel = new JLabel("Total Inventory Value: ");
    private JTextField totalInvValueText = new JTextField("");
    private JButton firstButton;
    private JButton previousButton;
    private JButton nextButton;
    private JButton lastButton;
    private JButton addButton;
    private JButton modifyButton;
    private JButton deleteButton;
    private JButton searchButton;
    private JButton saveButton;

    public Inventory() {
        setProductData();
        // Sort the products
        sortProducts(movieArray);

        JPanel buttonPanel = new JPanel();
        firstButton = new JButton("First");
        previousButton = new JButton("Previous");
        nextButton = new JButton("Next");
        lastButton = new JButton("Last");
        addButton = new JButton("Add");
        modifyButton = new JButton("Modify");
        deleteButton = new JButton("Delete");
        searchButton = new JButton("Search");
        saveButton = new JButton("Save");

        firstButton.addActionListener(this);
        previousButton.addActionListener(this);
        nextButton.addActionListener(this);
        lastButton.addActionListener(this);
        addButton.addActionListener(this);
        modifyButton.addActionListener(this);
        deleteButton.addActionListener(this);
        searchButton.addActionListener(this);
        saveButton.addActionListener(this);

        buttonPanel.add(firstButton);
        buttonPanel.add(previousButton);
        buttonPanel.add(nextButton);
        buttonPanel.add(lastButton);
        buttonPanel.add(addButton);
        buttonPanel.add(modifyButton);
        buttonPanel.add(deleteButton);
        buttonPanel.add(searchButton);
        buttonPanel.add(saveButton);

        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(buttonPanel, BorderLayout.SOUTH);

        JPanel dataPanel = new JPanel();
        dataPanel.setLayout(new GridLayout(8, 2));

        dataPanel.add(titleLabel);
        titleText.setEditable(false);
        dataPanel.add(titleText);

        dataPanel.add(itemNumberLabel);
        itemNumberText.setEditable(false);
        dataPanel.add(itemNumberText);

        dataPanel.add(unitsInStockLabel);
        unitsInStockText.setEditable(false);
        dataPanel.add(unitsInStockText);

        dataPanel.add(unitPriceLabel);
        unitPriceText.setEditable(false);
        dataPanel.add(unitPriceText);

        dataPanel.add(invValueLabel);
        invValueText.setEditable(false);
        dataPanel.add(invValueText);

        dataPanel.add(genreLabel);
        genreText.setEditable(false);
        dataPanel.add(genreText);

        dataPanel.add(restockingFeeLabel);
        restockingFeeText.setEditable(false);
        dataPanel.add(restockingFeeText);

        dataPanel.add(totalInvValueLabel);
        totalInvValueText.setEditable(false);
        dataPanel.add(totalInvValueText);

        JPanel dataLogoPanel = new JPanel();
        displayProduct();
        JPanel iconPanel = new LogoPanel();
        dataLogoPanel.add(iconPanel);
        dataLogoPanel.add(dataPanel);
        getContentPane().add(dataLogoPanel, BorderLayout.NORTH);

        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
        setSize(700, 300);
        setResizable(false);

    }

    private void setProductData() {
        DVDMovie DVDProduct1 = new DVDMovie(001, "Puss in Boots", 9, 15.99, "Animated");
        DVDMovie DVDProduct2 = new DVDMovie(002, "X-Men", 6, 19.99, "Action");
        DVDMovie DVDProduct3 = new DVDMovie(003, "Lincoln", 12, 17.99, "Drama - Historical");
        DVDMovie DVDProduct4 = new DVDMovie(004, "World War Z", 8, 18.99, "Action");
        DVDMovie DVDProduct5 = new DVDMovie(005, "Olympus Has Fallen", 11, 19.99, "Thriller");

        // Create Array to store the objects
        movieArray = new DVDMovie[5];
        movieArray[0] = DVDProduct1;
        movieArray[1] = DVDProduct2;
        movieArray[2] = DVDProduct3;
        movieArray[3] = DVDProduct4;
        movieArray[4] = DVDProduct5;
    }

    /**
     * This method is used to sort the products by DVD Title
     *
     * @param movieArray
     */
    private static void sortProducts(DVDMovie[] movieArray) {
        int length = movieArray.length;
        DVDMovie obj1 = null;
        DVDMovie obj2 = null;
        DVDMovie temp = null;
        for (int i = 1; i < length; i++) {
            for (int j = 0; j < length - i; j++) {
                obj1 = movieArray[j];
                obj2 = movieArray[j + 1];
                if (obj1.getDVDTitle().compareTo(obj2.getDVDTitle()) > 0) {
                    temp = obj1;
                    movieArray[j] = movieArray[j + 1];
                    movieArray[j + 1] = temp;
                }
            }
        }
    }

    /**
     * This method will be used to calculate the Entire Inventory Value
     *
     * @param movieArray
     * @return
     */
    private static double calculateEntireInventory(DVDMovie[] movieArray) {
        DVDMovie obj = null;
        double totalInventory = 0;
        for (int i = 0; i < movieArray.length; i++) {
            // Sets the current object in obj variable
            obj = movieArray[i];
            totalInventory += obj.getInventoryValue();
        }
        return totalInventory;
    }

    // button pushes...
    // // Sets the void for the next-button click

    public void actionPerformed(ActionEvent event) {
        if (event.getSource() == firstButton) {
            position = 0;
        } else if (event.getSource() == lastButton) {
            position = movieArray.length - 1;
        } else if (event.getSource() == previousButton) {
            if (position != 0) {
                position--;
            } else {
                position = movieArray.length - 1;
            }
        } else if (event.getSource() == nextButton) {
            if (position != (movieArray.length - 1)) {
                position++;
            } else {
                position = 0;
            }
        } else if (event.getSource() == modifyButton) {
            modifyItem();
        } else if (event.getSource() == addButton) {
            addItem();
            position = movieArray.length - 1;
        } else if (event.getSource() == deleteButton) {
            deleteItem();
        } else if (event.getSource() == searchButton) {
            searchProduct();
        } else if (event.getSource() == saveButton) {
            writeToFile();
        }
        displayProduct();
    }

    /**
     * This method is used to add the DVD
     */
    public void addItem() {
        // number should be greater then previous
        int lastElementIndex = movieArray.length - 1;
        int lastItemNumber = movieArray[lastElementIndex].getItemNumber();

        int newItemNumber = lastItemNumber + 1;
        String title = getDVDTitle();
        int numberOfUnits = getNumberOfItems();
        double unitPrice = getUnitPrice();
        String genre = getgenre();
        DVDMovie product = null;
        if (null != genre && genre.trim().length() > 0) {
            product = new DVD(newItemNumber, title, numberOfUnits,
                    unitPrice, genre);
        } else {
            product = new DVDMovie(newItemNumber, title, numberOfUnits, unitPrice);
        }

        DVDMovie[] existingArray = new DVDMovie[movieArray.length];
        for (int i = 0; i < movieArray.length; i++) {
            existingArray[i] = movieArray[i];
        }
        int newSize = existingArray.length + 1;

        movieArray = new DVDMovie[newSize];
        for (int i = 0; i < existingArray.length; i++) {
            movieArray[i] = existingArray[i];
        }
        movieArray[newSize - 1] = product;
        JOptionPane.showMessageDialog(null, "Movie added successfully!");

        position = movieArray.length - 1;
    }

    private String getgenre() {
        String genre = JOptionPane
                .showInputDialog("Enter DVD Genre: ");
        return genre;
    }

    private double getUnitPrice() {
        String unitPriceStr = "";
        double unitPrice = 0;
        while (true) {
            unitPriceStr = JOptionPane.showInputDialog("Enter Unit Price: ");
            if (unitPriceStr != null && !unitPriceStr.trim().equals("")) {
                try {
                    unitPrice = Double.parseDouble(unitPriceStr);
                    break;
                } catch (NumberFormatException e) {
                    JOptionPane
                            .showMessageDialog(null,
                                    "Please enter proper value for unit price.");
                }
            } else {
                JOptionPane.showMessageDialog(null,
                        "Please enter unit price.");
            }
        }
        return unitPrice;
    }

    private int getNumberOfItems() {
        String numberOfUnitsStr = "";
        int numberOfUnits = 0;
        while (true) {
            numberOfUnitsStr = JOptionPane
                    .showInputDialog("Enter Units in stock: ");
            if (numberOfUnitsStr != null && !numberOfUnitsStr.trim().equals("")) {
                try {
                    numberOfUnits = Integer.parseInt(numberOfUnitsStr);
                    break;
                } catch (NumberFormatException e) {
                    JOptionPane
                            .showMessageDialog(null,
                                    "Please enter proper value for quantity in stock.");
                }
            } else {
                JOptionPane.showMessageDialog(null,
                        "Please enter quantity in stock.");
            }
        }
        return numberOfUnits;
    }

    private String getDVDTitle() {
        String title = JOptionPane.showInputDialog("Enter DVD Title: ");
        while (title == null || title.trim().equals("")) {
            JOptionPane
                    .showMessageDialog(null, "Please enter DVD title.");
            title = JOptionPane.showInputDialog("Enter DVD Title: ");
        }
        return title;
    }

    public void displayDVD() {
        NumberFormat formatter = NumberFormat.getCurrencyInstance();
        DVDMovie DVD = movieArray[position];
        double totalInvValue = calculateEntireInventory(movieArray);

        titleText.setText(DVD.getDVDTitle());
        itemNumberText.setText(DVD.getItemNumber() + "");
        unitsInStockText.setText(DVD.getUnitsInStock() + "");
        unitPriceText.setText(formatter.format(DVD.getUnitPrice()));
        invValueText.setText(formatter.format(DVD.getInventoryValue()));
        restockingFeeLabel.setVisible(true);
        restockingFeeText.setVisible(true);
        genreText.setText(((DVD) DVD).getGenre());
        restockingFeeText.setText(formatter.format(((DVD) DVD).getRestockingFee()));

        totalInvValueText.setText(formatter.format(totalInvValue));
    }

    /**
     * This method is used to modify the product
     */
    public void modifyItem() {
        int itemNumStr = JOptionPane.showInputDialog("Enter the item number of the item you want to modify");
        if (null == itemNumStr || itemNumStr.equals("")) {
            JOptionPane.showMessageDialog(null, "No item number entered.");
            return;
        }
        int searchItemNumber = 0;
        try {
            searchItemNumber = itemNumStr;
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null,
                    "Please enter proper item number. Try again later.");
            return;
        }
        boolean matchFound = false;
        for (int i = 0; i < movieArray.length; i++) {
            if (searchItemNumber == movieArray[i].getItemNumber()) {
                matchFound = true;
                position = i;
                break;
            }
        }
        // No match found
        if (!matchFound) {
            JOptionPane.showMessageDialog(null,
                    "No product found having Item Number: " + searchItemNumber);
            return;
        }
        DVDMovie product = movieArray[position];

        String title = getDVDTitle();
        int itemNumber = searchItemNumber;
        int numberOfUnits = getNumberOfItems();
        double unitPrice = getUnitPrice();
        if (product instanceof DVD) {
            String genre = getgenre();
            ((DVD) product).setGenre(genre);
        }
        // Update the values
        product.setDVDTitle(title);
        product.setItemNumber(itemNumber);
        product.setUnitsInStock(numberOfUnits);
        product.setUnitPrice(unitPrice);
        JOptionPane.showMessageDialog(null, "Product successfully modified!");
    }

    /**
     * This method is used to delete the product
     */
    public void deleteItem() {
        String itemNumStr = JOptionPane
                .showInputDialog("Enter the item number of the item you want to delete");
        if (null == itemNumStr || itemNumStr.equals("")) {
            JOptionPane.showMessageDialog(null, "No item number entered.");
            return;
        }
        int searchItemNumber = 0;
        try {
            searchItemNumber = Integer.parseInt(itemNumStr);
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null,
                    "Please enter proper item number.Try again later!");
            return;
        }

        boolean matchFound = false;
        for (int i = 0; i < movieArray.length; i++) {
            if (searchItemNumber == movieArray[i].getItemNumber()) {
                matchFound = true;
                position = i;
                break;
            }
        }
        // No match found
        if (!matchFound) {
            JOptionPane.showMessageDialog(null,
                    "No matches found.");
            return;
        }
        DVDMovie productToBeDeleted = movieArray[position];
        // Decrease the array by 1 and add the new elements as last element
        DVDMovie[] existingArray = new DVDMovie[movieArray.length];
        for (int i = 0; i < movieArray.length; i++) {
            existingArray[i] = movieArray[i];
        }
        int newSize = existingArray.length - 1;
        // Decrease the size by 1
        movieArray = new DVDMovie[newSize];
        int counter = 0;
        for (int i = 0; i < existingArray.length; i++) {
            if (existingArray[i].getItemNumber() != productToBeDeleted
                    .getItemNumber()) {
                movieArray[counter] = existingArray[i];
                counter++;
            }
        }
        JOptionPane.showMessageDialog(null, "Product deleted successfully!");
        // Set position to newly added product
        position = movieArray.length - 1;
    }

    /**
     * This method is used to search the product
     */
    public void searchProduct() {
        String itemNumStr = JOptionPane
                .showInputDialog("Enter the item number of the item you want to search");
        if (null == itemNumStr || itemNumStr.equals("")) {
            JOptionPane.showMessageDialog(null, "No item number entered.");
            return;
        }
        int searchItemNumber = 0;
        try {
            searchItemNumber = Integer.parseInt(itemNumStr);
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null,
                    "Please enter proper item number.Try again later!");
            return;
        }

        boolean matchFound = false;
        for (int i = 0; i < movieArray.length; i++) {
            if (searchItemNumber == movieArray[i].getItemNumber()) {
                matchFound = true;
                position = i;
                break;
            }
        }

        // No match found
        if (!matchFound) {
            JOptionPane.showMessageDialog(null,
                    "No product found having Item Number: " + searchItemNumber);
        } else {
            JOptionPane.showMessageDialog(null, "Product found.");
        }

    }

    /**
     * This method is used to write to file
     */
    public void writeToFile() {
        try {
            File file = new File("c:\\data\\inventory.dat");
            if (!file.exists()) {
                new File("c:\\data\\").mkdir();

            }
            PrintWriter outFile = new PrintWriter(new FileWriter(
                    "c:\\data\\inventory.dat"));

            DVDMovie product = null;
            NumberFormat nf = NumberFormat.getCurrencyInstance();
            for (int i = 0; i < movieArray.length; i++) {
                product = movieArray[i];
                outFile.println("DVD Title: " + product.getDVDTitle());
                outFile.println("Item Number: " + product.getItemNumber());
                outFile.println("Units in stock: " + product.getUnitsInStock());
                outFile.println("Unit Price: " + product.getUnitPrice());
                outFile.println("Inventory Value: "+ nf.format(product.getInventoryValue()));
                outFile.println("DVD Genre: "+ ((DVD) product).getGenre());
                outFile.println("Restocking Fee: "+ (((DVD) product).getRestockingFee()));

                outFile.println();
                outFile.println();
            }
            JOptionPane.showMessageDialog(null, "inventory.dat saved.");
            outFile.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    // main method
    public static void main(String[] args) {
        Inventory gui = new Inventory();
        gui.setVisible(true);

    }
}

class LogoPanel extends JPanel {

    ImageIcon image = null;
    private static String COMPANY_LOGO = "/companylogo.jpg";

    public LogoPanel() {
        image = new ImageIcon(COMPANY_LOGO);
    }

    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        image.paintIcon(this, g, 0, 0);
    }

    public Dimension getPreferredSize() {
        return new Dimension(image.getIconWidth(), image.getIconHeight());
    }
}

**********************DVD*********************

/**
 * 
 * @author
 */
// This is class is used to hold the product information for the DVD
public class DVD extends DVDMovie {

    private String genre;

    /**
     * Argument constructor to initialize the object with passed values
     * 
     * @param itemNumber
     * @param DVDTitle
     * @param unitsInStock
     * @param unitPrice
     * @param genre
     */
    public DVD(int itemNumber, String DVDTitle, int unitsInStock, double unitPrice, String genre) {
        super(itemNumber, DVDTitle, unitsInStock, unitPrice);
        this.genre = genre;
    }

    // calculates inventory value after adding restocking fee
    @Override
    public double getInventoryValue() {
        double value = super.getInventoryValue();
        // Add 5% restocking fee
        value = value + getRestockingFee();
        return value;
    }

    // Restocking fee is 5% of value
    public double getRestockingFee() {
        double value = super.getInventoryValue();
        return value * 0.05;
    }

    @Override
    public String toString() {
        String str = super.toString();
        str += "DVD Genre: " + getGenre() + "\n";
        return str;
    }

    //
    // Accessors and Mutator for Class fields
    //
    public String getGenre() {
        return genre;
    }

    public void setGenre(String genre) {
        this.genre = genre;
    }

}

********************ERRORS********************

The errors I'm getting are in the Inventory.java file and I cannot figure out how to correct them.

1) The serializable class LogoPanel does not declare a static final serialVersionUID field of type long /DVDInventory line 539

2) Cannot invoke equals(String) on the primitive type int /DVDInventory line 359

3) The assignment to variable dvdTitle has no effect /DVDInventory line 72

4) The serializable class Inventory does not declare a static final serialVersionUID field of type long /DVDInventory line 25

5) The operator == is undefined for the argument type(s) null, int /DVDInventory line 359

6) Type mismatch: cannot convert from String to int /DVDInventory line 358

Again, any help resolvile these issues in a timely manner would be greatly appreciated as this is due by Sunday 2/2.

Recommended Answers

All 12 Replies

Inside the constructor of Inventory, you are calling displayProduct() method which does not exist in the class.

The serializable class LogoPanel does not declare a static final serialVersionUID field of type long (etc)

This is basically a stupid warning message that you can completely ignore. If it bothers you, just add this line inside each class it complains about:
static final long serialVersionUID =0;

Cannot invoke equals(String) on the primitive type int /DVDInventory line 359

You declared itemNumStr as an int, so you can't use it to call String methods.

The assignment to variable dvdTitle has no effect /DVDInventory line 72

You lost track of your capitalisation (dvdTitle vs DVDTitle)

The operator == is undefined for the argument type(s) null, int /DVDInventory line 359

itemNumStr is an int. Primitives like ints cannot ever be null, so you can't test for null == int

Type mismatch: cannot convert from String to int /DVDInventory line 358

Yet again, itemNumStr is an int, but you need a String here

OK. I've made some changes and now I'm getting a different set of errors.

**************DVD****************

/**
 * 
 * @author
 */
// This is class is used to hold the product information for the DVD
public class DVD extends DVDMovie {

    private String genre;

    /**
     * Argument constructor to initialize the object with passed values
     * 
     * @param newItemNumber
     * @param DVDTitle
     * @param unitsInStock
     * @param unitPrice
     * @param genre
     */
    public DVD(int newItemNumber, String DVDTitle, int unitsInStock, double unitPrice, String genre) {
        super(newItemNumber, DVDTitle, unitsInStock, unitPrice);
        this.genre = genre;
    }

    // calculates inventory value after adding restocking fee
    @Override
    public double getInventoryValue() {
        double value = super.getInventoryValue();
        // Add 5% restocking fee
        value = value + getRestockingFee();
        return value;
    }

    // Restocking fee is 5% of value
    public double getRestockingFee() {
        double value = super.getInventoryValue();
        return value * 0.05;
    }

    @Override
    public String toString() {
        String str = super.toString();
        str += "DVD Genre: " + getGenre() + "\n";
        return str;
    }

    //
    // Accessors and Mutator for Class fields
    //
    public String getGenre() {
        return genre;
    }

    public void setGenre(String genre) {
        this.genre = genre;
    }

}

*************Inventory***************

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.text.NumberFormat;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author
 */
// This is the Driver program for Product
public class Inventory extends JFrame implements ActionListener {
    // Index of current element of array
    static final long serialVersionUID =0;
    private int position = 0;
    // create Products array
    DVDMovie[] movieArray = null;
    // Various components that are used in the program
    private JLabel titleLabel = new JLabel("DVD Title: ");
    private JTextField titleText = new JTextField("");
    private JLabel itemNumberLabel = new JLabel("Item Number: ");
    private JTextField itemNumberText = new JTextField("");
    private JLabel unitsInStockLabel = new JLabel("Units In Stock: ");
    private JTextField unitsInStockText = new JTextField("");
    private JLabel unitPriceLabel = new JLabel("Unit Price: ");
    private JTextField unitPriceText = new JTextField("");
    private JLabel invValueLabel = new JLabel("Inventory Value: ");
    private JTextField invValueText = new JTextField("");
    // Product object related components
    private JLabel genreLabel = new JLabel("DVD Genre: ");
    private JTextField genreText = new JTextField("");
    private JLabel restockingFeeLabel = new JLabel("Restocking Fee: ");
    private JTextField restockingFeeText = new JTextField("");
    private JLabel totalInvValueLabel = new JLabel("Total Inventory Value: ");
    private JTextField totalInvValueText = new JTextField("");
    private JButton firstButton;
    private JButton previousButton;
    private JButton nextButton;
    private JButton lastButton;
    private JButton addButton;
    private JButton modifyButton;
    private JButton deleteButton;
    private JButton searchButton;
    private JButton saveButton;
    private String searchDVDTitle;

    public Inventory() {
        setProductData();
        // Sort the products
        sortProducts(movieArray);

        JPanel buttonPanel = new JPanel();
        firstButton = new JButton("First");
        previousButton = new JButton("Previous");
        nextButton = new JButton("Next");
        lastButton = new JButton("Last");
        addButton = new JButton("Add");
        modifyButton = new JButton("Modify");
        deleteButton = new JButton("Delete");
        searchButton = new JButton("Search");
        saveButton = new JButton("Save");

        firstButton.addActionListener(this);
        previousButton.addActionListener(this);
        nextButton.addActionListener(this);
        lastButton.addActionListener(this);
        addButton.addActionListener(this);
        modifyButton.addActionListener(this);
        deleteButton.addActionListener(this);
        searchButton.addActionListener(this);
        saveButton.addActionListener(this);

        buttonPanel.add(firstButton);
        buttonPanel.add(previousButton);
        buttonPanel.add(nextButton);
        buttonPanel.add(lastButton);
        buttonPanel.add(addButton);
        buttonPanel.add(modifyButton);
        buttonPanel.add(deleteButton);
        buttonPanel.add(searchButton);
        buttonPanel.add(saveButton);

        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(buttonPanel, BorderLayout.SOUTH);

        JPanel dataPanel = new JPanel();
        dataPanel.setLayout(new GridLayout(8, 2));

        dataPanel.add(titleLabel);
        titleText.setEditable(false);
        dataPanel.add(titleText);

        dataPanel.add(itemNumberLabel);
        itemNumberText.setEditable(false);
        dataPanel.add(itemNumberText);

        dataPanel.add(unitsInStockLabel);
        unitsInStockText.setEditable(false);
        dataPanel.add(unitsInStockText);

        dataPanel.add(unitPriceLabel);
        unitPriceText.setEditable(false);
        dataPanel.add(unitPriceText);

        dataPanel.add(invValueLabel);
        invValueText.setEditable(false);
        dataPanel.add(invValueText);

        dataPanel.add(genreLabel);
        genreText.setEditable(false);
        dataPanel.add(genreText);

        dataPanel.add(restockingFeeLabel);
        restockingFeeText.setEditable(false);
        dataPanel.add(restockingFeeText);

        dataPanel.add(totalInvValueLabel);
        totalInvValueText.setEditable(false);
        dataPanel.add(totalInvValueText);

        JPanel dataLogoPanel = new JPanel();
        displayDVD();
        JPanel iconPanel = new LogoPanel();
        dataLogoPanel.add(iconPanel);
        dataLogoPanel.add(dataPanel);
        getContentPane().add(dataLogoPanel, BorderLayout.NORTH);

        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
        setSize(700, 300);
        setResizable(false);

    }

    private void setProductData() {
        DVDMovie DVDProduct1 = new DVDMovie(001, "Puss in Boots", 9, 15.99, "Animated");
        DVDMovie DVDProduct2 = new DVDMovie(002, "X-Men", 6, 19.99, "Action");
        DVDMovie DVDProduct3 = new DVDMovie(003, "Lincoln", 12, 17.99, "Drama - Historical");
        DVDMovie DVDProduct4 = new DVDMovie(004, "World War Z", 8, 18.99, "Action");
        DVDMovie DVDProduct5 = new DVDMovie(005, "Olympus Has Fallen", 11, 19.99, "Thriller");

        // Create Array to store the objects
        movieArray = new DVDMovie[5];
        movieArray[0] = DVDProduct1;
        movieArray[1] = DVDProduct2;
        movieArray[2] = DVDProduct3;
        movieArray[3] = DVDProduct4;
        movieArray[4] = DVDProduct5;
    }

    /**
     * This method is used to sort the products by DVD Title
     *
     * @param movieArray
     */
    private static void sortProducts(DVDMovie[] movieArray) {
        int length = movieArray.length;
        DVDMovie obj1 = null;
        DVDMovie obj2 = null;
        DVDMovie temp = null;
        for (int i = 1; i < length; i++) {
            for (int j = 0; j < length - i; j++) {
                obj1 = movieArray[j];
                obj2 = movieArray[j + 1];
                if (obj1.getDVDTitle().compareTo(obj2.getDVDTitle()) > 0) {
                    temp = obj1;
                    movieArray[j] = movieArray[j + 1];
                    movieArray[j + 1] = temp;
                }
            }
        }
    }

    /**
     * This method will be used to calculate the Entire Inventory Value
     *
     * @param movieArray
     * @return
     */
    private static double calculateEntireInventory(DVDMovie[] movieArray) {
        DVDMovie obj = null;
        double totalInventory = 0;
        for (int i = 0; i < movieArray.length; i++) {
            // Sets the current object in obj variable
            obj = movieArray[i];
            totalInventory += obj.getInventoryValue();
        }
        return totalInventory;
    }

    // button pushes...
    // // Sets the void for the next-button click

    public void actionPerformed(ActionEvent event) {
        if (event.getSource() == firstButton) {
            position = 0;
        } else if (event.getSource() == lastButton) {
            position = movieArray.length - 1;
        } else if (event.getSource() == previousButton) {
            if (position != 0) {
                position--;
            } else {
                position = movieArray.length - 1;
            }
        } else if (event.getSource() == nextButton) {
            if (position != (movieArray.length - 1)) {
                position++;
            } else {
                position = 0;
            }
        } else if (event.getSource() == modifyButton) {
            modifyItem();
        } else if (event.getSource() == addButton) {
            addItem();
            position = movieArray.length - 1;
        } else if (event.getSource() == deleteButton) {
            deleteItem();
        } else if (event.getSource() == searchButton) {
            searchProduct();
        } else if (event.getSource() == saveButton) {
            writeToFile();
        }
        displayDVD();
    }

    /**
     * This method is used to add the DVD
     */
    public void addItem() {
        // number should be greater then previous
        int lastElementIndex = movieArray.length - 1;
        int lastItemNumber = movieArray[lastElementIndex].getItemNumber();

        int newItemNumber = lastItemNumber + 1;
        String title = getDVDTitle();
        int numberOfUnits = getNumberOfItems();
        double unitPrice = getUnitPrice();
        String genre = getgenre();
        DVDMovie product = null;
        if (null != genre && genre.trim().length() > 0) {
            product = new DVD(newItemNumber, title, numberOfUnits, unitPrice, genre);
        } else {
            product = new DVDMovie(newItemNumber, title, numberOfUnits, unitPrice);
        }

        DVDMovie[] existingArray = new DVDMovie[movieArray.length];
        for (int i = 0; i < movieArray.length; i++) {
            existingArray[i] = movieArray[i];
        }
        int newSize = existingArray.length + 1;

        movieArray = new DVDMovie[newSize];
        for (int i = 0; i < existingArray.length; i++) {
            movieArray[i] = existingArray[i];
        }
        movieArray[newSize - 1] = product;
        JOptionPane.showMessageDialog(null, "Movie added successfully!");

        position = movieArray.length - 1;
    }

    private String getgenre() {
        String genre = JOptionPane
                .showInputDialog("Enter DVD Genre: ");
        return genre;
    }

    private double getUnitPrice() {
        String unitPriceStr = "";
        double unitPrice = 0;
        while (true) {
            unitPriceStr = JOptionPane.showInputDialog("Enter Unit Price: ");
            if (unitPriceStr != null && !unitPriceStr.trim().equals("")) {
                try {
                    unitPrice = Double.parseDouble(unitPriceStr);
                    break;
                } catch (NumberFormatException e) {
                    JOptionPane
                            .showMessageDialog(null,
                                    "Please enter proper value for unit price.");
                }
            } else {
                JOptionPane.showMessageDialog(null,
                        "Please enter unit price.");
            }
        }
        return unitPrice;
    }

    private int getNumberOfItems() {
        String numberOfUnitsStr = "";
        int numberOfUnits = 0;
        while (true) {
            numberOfUnitsStr = JOptionPane
                    .showInputDialog("Enter Units in stock: ");
            if (numberOfUnitsStr != null && !numberOfUnitsStr.trim().equals("")) {
                try {
                    numberOfUnits = Integer.parseInt(numberOfUnitsStr);
                    break;
                } catch (NumberFormatException e) {
                    JOptionPane
                            .showMessageDialog(null,
                                    "Please enter proper value for quantity in stock.");
                }
            } else {
                JOptionPane.showMessageDialog(null,
                        "Please enter quantity in stock.");
            }
        }
        return numberOfUnits;
    }

    private String getDVDTitle() {
        String title = JOptionPane.showInputDialog("Enter DVD Title: ");
        while (title == null || title.trim().equals("")) {
            JOptionPane
                    .showMessageDialog(null, "Please enter DVD title.");
            title = JOptionPane.showInputDialog("Enter DVD Title: ");
        }
        return title;
    }

    public void displayDVD() {
        NumberFormat formatter = NumberFormat.getCurrencyInstance();
        DVDMovie DVD = movieArray[position];
        double totalInvValue = calculateEntireInventory(movieArray);

        titleText.setText(DVD.getDVDTitle());
        itemNumberText.setText(DVD.getItemNumber() + "");
        unitsInStockText.setText(DVD.getUnitsInStock() + "");
        unitPriceText.setText(formatter.format(DVD.getUnitPrice()));
        invValueText.setText(formatter.format(DVD.getInventoryValue()));
        restockingFeeLabel.setVisible(true);
        restockingFeeText.setVisible(true);
        genreText.setText(((DVD) DVD).getGenre());
        restockingFeeText.setText(formatter.format(((DVD) DVD).getRestockingFee()));

        totalInvValueText.setText(formatter.format(totalInvValue));
    }

    /**
     * This method is used to modify the product
     */
    public void modifyItem() {
        String itemNumStr = JOptionPane.showInputDialog("Enter the item number of the item you want to modify");
        if (null == itemNumStr || itemNumStr.equals("")) {
            JOptionPane.showMessageDialog(null, "No item number entered.");
            return;
        }
        String searchDVDTitle = " ";
        try {
            searchDVDTitle = itemNumStr;
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null,
                    "Please enter proper item number. Try again later.");
            return;
        }
        boolean matchFound = false;
        for (int i = 0; i < movieArray.length; i++) {
            if (searchDVDTitle == movieArray[i].getDVDTitle()) {
                matchFound = true;
                position = i;
                break;
            }
        }
        // No match found
        if (!matchFound) {
            JOptionPane.showMessageDialog(null,
                    "No DVD matching that title found.  Did you type it correctly? You searched for" +searchDVDTitle);
            return;
        }
        DVDMovie product = movieArray[position];

        String title = getDVDTitle();
        //String itemNumber = searchItemNumber;
        int numberOfUnits = getNumberOfItems();
        double unitPrice = getUnitPrice();
        if (product instanceof DVD) {
            String genre = getgenre();
            ((DVD) product).setGenre(genre);
        }
        // Update the values
        product.setDVDTitle(title);
        int itemNumber = 0;
        product.setItemNumber(itemNumber);
        product.setUnitsInStock(numberOfUnits);
        product.setUnitPrice(unitPrice);
        JOptionPane.showMessageDialog(null, "Product successfully modified!");
    }

    /**
     * This method is used to delete the product
     */
    public void deleteItem() {
        String DVDTitle = JOptionPane
                .showInputDialog("Enter the item number of the item you want to delete");
        if (null == DVDTitle || DVDTitle.equals("")) {
            JOptionPane.showMessageDialog(null, "No item number entered.");
            return;
        }
        int searchDVDTitle = 0;
        try {
            searchDVDTitle = Integer.parseInt(DVDTitle);
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null,
                    "Please enter proper item number.Try again later!");
            return;
        }

        boolean matchFound = false;
        for (int i = 0; i < movieArray.length; i++) {
            if (searchDVDTitle == movieArray[i].getItemNumber()) {
                matchFound = true;
                position = i;
                break;
            }
        }
        // No match found
        if (!matchFound) {
            JOptionPane.showMessageDialog(null,
                    "No matches found.");
            return;
        }
        DVDMovie productToBeDeleted = movieArray[position];
        // Decrease the array by 1 and add the new elements as last element
        DVDMovie[] existingArray = new DVDMovie[movieArray.length];
        for (int i = 0; i < movieArray.length; i++) {
            existingArray[i] = movieArray[i];
        }
        int newSize = existingArray.length - 1;
        // Decrease the size by 1
        movieArray = new DVDMovie[newSize];
        int counter = 0;
        for (int i = 0; i < existingArray.length; i++) {
            if (existingArray[i].getDVDTitle() != productToBeDeleted.getDVDTitle()) {
                movieArray[counter] = existingArray[i];
                counter++;
            }
        }
        JOptionPane.showMessageDialog(null, "Product deleted successfully!");
        // Set position to newly added product
        position = movieArray.length - 1;
    }

    /**
     * This method is used to search the product
     */
    public void searchProduct() {
        String DVDTitle = JOptionPane
                .showInputDialog("Enter the item number of the item you want to search");
        if (null == DVDTitle || DVDTitle.equals("")) {
            JOptionPane.showMessageDialog(null, "No item number entered.");
            return;
        }
        int searchItemNumber = 0;
        try {
            searchItemNumber = Integer.parseInt(DVDTitle);
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null,
                    "Please enter proper item number.Try again later!");
            return;
        }

        boolean matchFound = false;
        for (int i = 0; i < movieArray.length; i++) {
            if (searchDVDTitle == movieArray[i].getDVDTitle()) {
                matchFound = true;
                position = i;
                break;
            }
        }

        // No match found
        if (!matchFound) {
            JOptionPane.showMessageDialog(null,
                    "No product found having Item Number: " + searchItemNumber);
        } else {
            JOptionPane.showMessageDialog(null, "Product found.");
        }

    }

    /**
     * This method is used to write to file
     */
    public void writeToFile() {
        try {
            File file = new File("c:\\data\\inventory.dat");
            if (!file.exists()) {
                new File("c:\\data\\").mkdir();

            }
            PrintWriter outFile = new PrintWriter(new FileWriter(
                    "c:\\data\\inventory.dat"));

            DVDMovie product = null;
            NumberFormat nf = NumberFormat.getCurrencyInstance();
            for (int i = 0; i < movieArray.length; i++) {
                product = movieArray[i];
                outFile.println("DVD Title: " + product.getDVDTitle());
                outFile.println("Item Number: " + product.getItemNumber());
                outFile.println("Units in stock: " + product.getUnitsInStock());
                outFile.println("Unit Price: " + product.getUnitPrice());
                outFile.println("Inventory Value: "+ nf.format(product.getInventoryValue()));
                outFile.println("DVD Genre: "+ ((DVD) product).getGenre());
                outFile.println("Restocking Fee: "+ (((DVD) product).getRestockingFee()));

                outFile.println();
                outFile.println();
            }
            JOptionPane.showMessageDialog(null, "inventory.dat saved.");
            outFile.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    // main method
    public static void main(String[] args) {
        Inventory gui = new Inventory();
        gui.setVisible(true);

    }
}

class LogoPanel extends JPanel {

    ImageIcon image = null;
    private static String COMPANY_LOGO = "/companylogo.jpg";
    static final long serialVersionUID =0;
    public LogoPanel() {
        image = new ImageIcon(COMPANY_LOGO);
    }

    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        image.paintIcon(this, g, 0, 0);
    }

    public Dimension getPreferredSize() {
        return new Dimension(image.getIconWidth(), image.getIconHeight());
    }
}

***************DVDMovie******************

import java.text.NumberFormat;

/**
 * 
 * @author
 */
// This is class is used to hold the product information for the inventory
// program
public class DVDMovie {

    // item number field
    private int itemNumber;

    // DVD title field
    private String DVDTitle;

    // number of units in stock
    private int unitsInStock;

    // price per unit from stock
    private double unitPrice;

    // DVD genre
    private String genre;

    // default no argument constructor
    public DVDMovie(int itemNumber, String dvdTitle, int unitsInStock, double unitPrice, String genre) {
        this.itemNumber = 0;
        this.DVDTitle = "unknown";
        this.unitsInStock = 0;
        this.unitPrice = 0;
        this.setGenre("unknown");
    }

        /**
     * Argument constructor to initialize the object with passed values
     * 
     * @param itemNumber
     * @param DVDTitle
     * @param unitsInStock
     * @param unitPrice
     */
    public DVDMovie(int itemNumber, String DVDTitle, int unitsInStock, double unitPrice) {
        this.itemNumber = itemNumber;
        this.DVDTitle = DVDTitle;
        this.unitsInStock = unitsInStock;
        this.unitPrice = unitPrice;
    }

    // calculates inventory value for this product
    public double getInventoryValue() {
        return unitPrice * unitsInStock;
    }

    //
    // Accessors and Mutator for Class fields
    //
    public int getItemNumber() {
        return itemNumber;
    }

    public void setItemNumber(int itemNumber2) {
        this.itemNumber = itemNumber2;
    }

    public String getDVDTitle() {
        return DVDTitle;
    }

    public void setDVDTitle(String DVDTitle) {
        this.DVDTitle = DVDTitle;
    }

    public int getUnitsInStock() {
        return unitsInStock;
    }

    public void setUnitsInStock(int unitsInStock) {
        this.unitsInStock = unitsInStock;
    }

    public double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(double unitPrice) {
        this.unitPrice = unitPrice;
    }

    public String toString() {
        NumberFormat formatter = NumberFormat.getCurrencyInstance();
        String str = "Number: " + getItemNumber();
        str += ", DVD Title: " + getDVDTitle();
        str += ", In Stock: " + getUnitsInStock();
        str += ", Unit Price: " + getUnitPrice() + "\n";
        str += "Inventory Value: " + formatter.format(getInventoryValue())
                + "\n";
        return str;
    }

    /**
     * @return the genre
     */
    public String getGenre() {
        return genre;
    }

    /**
     * @param genre the genre to set
     */
    public void setGenre(String genre) {
        this.genre = genre;
    }
}

Here is what I'm getting now. It still will not compile.

Exception in thread "main" java.lang.ClassCastException: DVDMovie cannot be cast to DVD
    at Inventory.displayDVD(Inventory.java:348)
    at Inventory.<init>(Inventory.java:135)
    at Inventory.main(Inventory.java:533)

Any suggestions how to get this to compile and run would be greatly appreciated

The message tells you exactly what went wrong and exactly where in the program it went wrong. What is it about that that you don't understand?
It doesn't help that you have defined a variable DVD wuth the same name as a class (DVD), and incidentally ignored the usual naming conventions. On the other hand it's quite an achievement to make ((DVD) DVD).someMethod() compile!

OK, I've got this thing to compile and run, but it is not displaying anything in the text fields. Now I'm getting some new errors and cannot figure out how to correct them. When I test it in NetBeans it does compile, and display properly, but there is no information displayed and nothing appears to happen when the buttons are clicked.

***************Inventory****************

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.text.NumberFormat;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
/**
 *
 * @author
 */
// This is the Driver program for Product
public class Inventory extends JFrame implements ActionListener {
    // Index of current element of array
    static final long serialVersionUID =0;
    private int position = 0;
    // create Products array
    DVDMovie[] movieArray = null;
    // Various components that are used in the program
    private JLabel titleLabel = new JLabel("DVD Title: ");
    private JTextField titleText = new JTextField("");
    private JLabel itemNumberLabel = new JLabel("Item Number: ");
    private JTextField itemNumberText = new JTextField("");
    private JLabel unitsInStockLabel = new JLabel("Units In Stock: ");
    private JTextField unitsInStockText = new JTextField("");
    private JLabel unitPriceLabel = new JLabel("Unit Price: ");
    private JTextField unitPriceText = new JTextField("");
    private JLabel invValueLabel = new JLabel("Inventory Value: ");
    private JTextField invValueText = new JTextField("");
    // Product object related components
    private JLabel genreLabel = new JLabel("DVD Genre: ");
    private JTextField genreText = new JTextField("");
    private JLabel restockingFeeLabel = new JLabel("Restocking Fee: ");
    private JTextField restockingFeeText = new JTextField("");
    private JLabel totalInvValueLabel = new JLabel("Total Inventory Value: ");
    private JTextField totalInvValueText = new JTextField("");
    private JButton firstButton;
    private JButton previousButton;
    private JButton nextButton;
    private JButton lastButton;
    private JButton addButton;
    private JButton modifyButton;
    private JButton deleteButton;
    private JButton searchButton;
    private JButton saveButton;
    private String searchDVDTitle;
    public Inventory() {
        setProductData();
        // Sort the products
        sortProducts(movieArray);
        JPanel buttonPanel = new JPanel();
        firstButton = new JButton("First");
        previousButton = new JButton("Previous");
        nextButton = new JButton("Next");
        lastButton = new JButton("Last");
        addButton = new JButton("Add");
        modifyButton = new JButton("Modify");
        deleteButton = new JButton("Delete");
        searchButton = new JButton("Search");
        saveButton = new JButton("Save");
        firstButton.addActionListener(this);
        previousButton.addActionListener(this);
        nextButton.addActionListener(this);
        lastButton.addActionListener(this);
        addButton.addActionListener(this);
        modifyButton.addActionListener(this);
        deleteButton.addActionListener(this);
        searchButton.addActionListener(this);
        saveButton.addActionListener(this);
        buttonPanel.add(firstButton);
        buttonPanel.add(previousButton);
        buttonPanel.add(nextButton);
        buttonPanel.add(lastButton);
        buttonPanel.add(addButton);
        buttonPanel.add(modifyButton);
        buttonPanel.add(deleteButton);
        buttonPanel.add(searchButton);
        buttonPanel.add(saveButton);
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(buttonPanel, BorderLayout.SOUTH);
        JPanel dataPanel = new JPanel();
        dataPanel.setLayout(new GridLayout(8, 2));
        dataPanel.add(titleLabel);
        titleText.setEditable(false);
        dataPanel.add(titleText);
        dataPanel.add(itemNumberLabel);
        itemNumberText.setEditable(false);
        dataPanel.add(itemNumberText);
        dataPanel.add(unitsInStockLabel);
        unitsInStockText.setEditable(false);
        dataPanel.add(unitsInStockText);
        dataPanel.add(unitPriceLabel);
        unitPriceText.setEditable(false);
        dataPanel.add(unitPriceText);
        dataPanel.add(invValueLabel);
        invValueText.setEditable(false);
        dataPanel.add(invValueText);
        dataPanel.add(genreLabel);
        genreText.setEditable(false);
        dataPanel.add(genreText);
        dataPanel.add(restockingFeeLabel);
        restockingFeeText.setEditable(false);
        dataPanel.add(restockingFeeText);
        dataPanel.add(totalInvValueLabel);
        totalInvValueText.setEditable(false);
        dataPanel.add(totalInvValueText);
        JPanel dataLogoPanel = new JPanel();
      //  displayDVD();
        JPanel iconPanel = new LogoPanel();
        dataLogoPanel.add(iconPanel);
        dataLogoPanel.add(dataPanel);
        getContentPane().add(dataLogoPanel, BorderLayout.NORTH);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
        setSize(700, 300);
        setResizable(false);
    }
    private void setProductData() {
        DVDMovie DVDProduct1 = new DVDMovie(001, "Puss in Boots", 9, 15.99, "Animated");
        DVDMovie DVDProduct2 = new DVDMovie(002, "X-Men", 6, 19.99, "Action");
        DVDMovie DVDProduct3 = new DVDMovie(003, "Lincoln", 12, 17.99, "Drama - Historical");
        DVDMovie DVDProduct4 = new DVDMovie(004, "World War Z", 8, 18.99, "Action");
        DVDMovie DVDProduct5 = new DVDMovie(005, "Olympus Has Fallen", 11, 19.99, "Thriller");
        // Create Array to store the objects
        movieArray = new DVDMovie[5];
        movieArray[0] = DVDProduct1;
        movieArray[1] = DVDProduct2;
        movieArray[2] = DVDProduct3;
        movieArray[3] = DVDProduct4;
        movieArray[4] = DVDProduct5;
    }
    /**
     * This method is used to sort the products by DVD Title
     *
     * @param movieArray
     */
    private static void sortProducts(DVDMovie[] movieArray) {
        int length = movieArray.length;
        DVDMovie obj1 = null;
        DVDMovie obj2 = null;
        DVDMovie temp = null;
        for (int i = 1; i < length; i++) {
            for (int j = 0; j < length - i; j++) {
                obj1 = movieArray[j];
                obj2 = movieArray[j + 1];
                if (obj1.getDVDTitle().compareTo(obj2.getDVDTitle()) > 0) {
                    temp = obj1;
                    movieArray[j] = movieArray[j + 1];
                    movieArray[j + 1] = temp;
                }
            }
        }
    }
    /**
     * This method will be used to calculate the Entire Inventory Value
     *
     * @param movieArray
     * @return
     */
    private static double calculateEntireInventory(DVDMovie[] movieArray) {
        DVDMovie DVDMovie= null;
        double totalInventory = 0;
        for (int i = 0; i < movieArray.length; i++) {
            totalInventory += DVDMovie.getInventoryValue();
        }
        return totalInventory;
    }
    // button pushes...
    // // Sets the void for the next-button click
    public void actionPerformed(ActionEvent event) {
        if (event.getSource() == firstButton) {
            position = 0;
        } else if (event.getSource() == lastButton) {
            position = movieArray.length - 1;
        } else if (event.getSource() == previousButton) {
            if (position != 0) {
                position--;
            } else {
                position = movieArray.length - 1;
            }
        } else if (event.getSource() == nextButton) {
            if (position != (movieArray.length - 1)) {
                position++;
            } else {
                position = 0;
            }
        } else if (event.getSource() == modifyButton) {
            modifyItem();
        } else if (event.getSource() == addButton) {
            addItem();
            position = movieArray.length - 1;
        } else if (event.getSource() == deleteButton) {
            deleteItem();
        } else if (event.getSource() == searchButton) {
            searchProduct();
        } else if (event.getSource() == saveButton) {
            writeToFile();
        }
       // displayDVD();
    }
    /**
     * This method is used to add the DVD
     */
    public void addItem() {
        // number should be greater then previous
        int lastElementIndex = movieArray.length - 1;
        int lastItemNumber = movieArray[lastElementIndex].getItemNumber();
        int newItemNumber = lastItemNumber + 1;
        String title = getDVDTitle();
        int numberOfUnits = getNumberOfItems();
        double unitPrice = getUnitPrice();
        String genre = getgenre();
        DVDMovie product = null;
        if (null != genre && genre.trim().length() > 0) {
            product = new DVDMovie(newItemNumber, title, numberOfUnits, unitPrice, genre);
        } else {
            product = new DVDMovie(newItemNumber, title, numberOfUnits, unitPrice);
        }
        DVDMovie[] existingArray = new DVDMovie[movieArray.length];
        for (int i = 0; i < movieArray.length; i++) {
            existingArray[i] = movieArray[i];
        }
        int newSize = existingArray.length + 1;
        movieArray = new DVDMovie[newSize];
        for (int i = 0; i < existingArray.length; i++) {
            movieArray[i] = existingArray[i];
        }
        movieArray[newSize - 1] = product;
        JOptionPane.showMessageDialog(null, "Movie added successfully!");
        position = movieArray.length - 1;
    }
    private String getgenre() {
        String genre = JOptionPane
                .showInputDialog("Enter DVD Genre: ");
        return genre;
    }
    private double getUnitPrice() {
        String unitPriceStr = "";
        double unitPrice = 0;
        while (true) {
            unitPriceStr = JOptionPane.showInputDialog("Enter Unit Price: ");
            if (unitPriceStr != null && !unitPriceStr.trim().equals("")) {
                try {
                    unitPrice = Double.parseDouble(unitPriceStr);
                    break;
                } catch (NumberFormatException e) {
                    JOptionPane
                            .showMessageDialog(null,
                                    "Please enter proper value for unit price.");
                }
            } else {
                JOptionPane.showMessageDialog(null,
                        "Please enter unit price.");
            }
        }
        return unitPrice;
    }
    private int getNumberOfItems() {
        String numberOfUnitsStr = "";
        int numberOfUnits = 0;
        while (true) {
            numberOfUnitsStr = JOptionPane
                    .showInputDialog("Enter Units in stock: ");
            if (numberOfUnitsStr != null && !numberOfUnitsStr.trim().equals("")) {
                try {
                    numberOfUnits = Integer.parseInt(numberOfUnitsStr);
                    break;
                } catch (NumberFormatException e) {
                    JOptionPane
                            .showMessageDialog(null,
                                    "Please enter proper value for quantity in stock.");
                }
            } else {
                JOptionPane.showMessageDialog(null,
                        "Please enter quantity in stock.");
            }
        }
        return numberOfUnits;
    }
    private String getDVDTitle() {
        String title = JOptionPane.showInputDialog("Enter DVD Title: ");
        while (title == null || title.trim().equals("")) {
            JOptionPane
                    .showMessageDialog(null, "Please enter DVD title.");
            title = JOptionPane.showInputDialog("Enter DVD Title: ");
        }
        return title;
    }
    public void displayDVD() {
        DVDMovie DVD = movieArray[position];
        double totalInvValue = calculateEntireInventory(movieArray);
        titleText.setText(DVD.getDVDTitle());
        itemNumberText.setText(DVD.getItemNumber() + "");
        unitsInStockText.setText(DVD.getUnitsInStock() + "");
        unitPriceText.setText(DVD.getUnitPrice());
        invValueText.setText(DVDMovie.getInventoryValue());
       // restockingFeeLabel.setVisible(true);
       // restockingFeeText.setVisible(true);
        genreText.setText(DVDMovie.getGenre());
        restockingFeeText.setText(DVDMovie.getRestockingFee());
        totalInvValueText.setText(DVDMovie.totalInvValue());
    }
    private String DVDMOvie.getRestockingFee() {
        // TODO Auto-generated method stub
        return null;
    }
    /**
     * This method is used to modify the product
     */
    public void modifyItem() {
        String DVDTitle = JOptionPane.showInputDialog("Enter the item number of the item you want to modify");
        if (null == DVDTitle || DVDTitle.equals("")) {
            JOptionPane.showMessageDialog(null, "No item number entered.");
            return;
        }
        String searchDVDTitle = " ";
        try {
            searchDVDTitle = DVDTitle;
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null,
                    "Please enter proper item number. Try again later.");
            return;
        }
        boolean matchFound = false;
        for (int i = 0; i < movieArray.length; i++) {
            if (searchDVDTitle == movieArray[i].getDVDTitle()) {
                matchFound = true;
                position = i;
                break;
            }
        }
        // No match found
        if (!matchFound) {
            JOptionPane.showMessageDialog(null,
                    "No DVD matching that title found.  Did you type it correctly? You searched for" +searchDVDTitle);
            return;
        }
        DVDMovie product = movieArray[position];
        String title = getDVDTitle();
        //String itemNumber = searchItemNumber;
        int numberOfUnits = getNumberOfItems();
        double unitPrice = getUnitPrice();

        // Update the values
        product.setDVDTitle(title);
        int itemNumber = 0;
        product.setItemNumber(itemNumber);
        product.setUnitsInStock(numberOfUnits);
        product.setUnitPrice(unitPrice);
        JOptionPane.showMessageDialog(null, "Product successfully modified!");
    }
    /**
     * This method is used to delete the product
     */
    public void deleteItem() {
        String DVDTitle = JOptionPane
                .showInputDialog("Enter the item number of the item you want to delete");
        if (null == DVDTitle || DVDTitle.equals("")) {
            JOptionPane.showMessageDialog(null, "No item number entered.");
            return;
        }
        int searchDVDTitle = 0;
        try {
            searchDVDTitle = Integer.parseInt(DVDTitle);
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null,
                    "Please enter proper item number.Try again later!");
            return;
        }
        boolean matchFound = false;
        for (int i = 0; i < movieArray.length; i++) {
            if (searchDVDTitle == movieArray[i].getItemNumber()) {
                matchFound = true;
                position = i;
                break;
            }
        }
        // No match found
        if (!matchFound) {
            JOptionPane.showMessageDialog(null,
                    "No matches found.");
            return;
        }
        DVDMovie productToBeDeleted = movieArray[position];
        // Decrease the array by 1 and add the new elements as last element
        DVDMovie[] existingArray = new DVDMovie[movieArray.length];
        for (int i = 0; i < movieArray.length; i++) {
            existingArray[i] = movieArray[i];
        }
        int newSize = existingArray.length - 1;
        // Decrease the size by 1
        movieArray = new DVDMovie[newSize];
        int counter = 0;
        for (int i = 0; i < existingArray.length; i++) {
            if (existingArray[i].getDVDTitle() != productToBeDeleted.getDVDTitle()) {
                movieArray[counter] = existingArray[i];
                counter++;
            }
        }
        JOptionPane.showMessageDialog(null, "Product deleted successfully!");
        // Set position to newly added product
        position = movieArray.length - 1;
    }
    /**
     * This method is used to search the product
     */
    public void searchProduct() {
        String DVDTitle = JOptionPane
                .showInputDialog("Enter the item number of the item you want to search");
        if (null == DVDTitle || DVDTitle.equals("")) {
            JOptionPane.showMessageDialog(null, "No item number entered.");
            return;
        }
        int searchItemNumber = 0;
        try {
            searchItemNumber = Integer.parseInt(DVDTitle);
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null,
                    "Please enter proper item number.Try again later!");
            return;
        }
        boolean matchFound = false;
        for (int i = 0; i < movieArray.length; i++) {
            if (searchDVDTitle == movieArray[i].getDVDTitle()) {
                matchFound = true;
                position = i;
                break;
            }
        }
        // No match found
        if (!matchFound) {
            JOptionPane.showMessageDialog(null,
                    "No product found having Item Number: " + searchItemNumber);
        } else {
            JOptionPane.showMessageDialog(null, "Product found.");
        }
    }
    /**
     * This method is used to write to file
     */
    public void writeToFile() {
        try {
            File file = new File("c:\\data\\inventory.dat");
            if (!file.exists()) {
                new File("c:\\data\\").mkdir();
            }
            PrintWriter outFile = new PrintWriter(new FileWriter(
                    "c:\\data\\inventory.dat"));
            DVDMovie product = null;
            NumberFormat nf = NumberFormat.getCurrencyInstance();
            for (int i = 0; i < movieArray.length; i++) {
                product = movieArray[i];
                outFile.println("DVD Title: " + product.getDVDTitle());
                outFile.println("Item Number: " + product.getItemNumber());
                outFile.println("Units in stock: " + product.getUnitsInStock());
                outFile.println("Unit Price: " + product.getUnitPrice());
                outFile.println("Inventory Value: "+ nf.format(DVDMovie.getInventoryValue()));
                outFile.println("DVD Genre: "+ DVDMovie.getGenre());
                outFile.println("Restocking Fee: "+ DVDMovie.getRestockingFee());
                outFile.println();
                outFile.println();
            }
            JOptionPane.showMessageDialog(null, "inventory.dat saved.");
            outFile.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    // main method
    public static void main(String[] args) {
        Inventory gui = new Inventory();
        gui.setVisible(true);
    }
}
class LogoPanel extends JPanel {
    ImageIcon image = null;
    private static String COMPANY_LOGO = "/companylogo.jpg";
    static final long serialVersionUID =0;
    public LogoPanel() {
        image = new ImageIcon(COMPANY_LOGO);
    }
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        image.paintIcon(this, g, 0, 0);
    }
    public Dimension getPreferredSize() {
        return new Dimension(image.getIconWidth(), image.getIconHeight());
    }
}

*************DVDMovie*****************

public class DVDMovie {
    // item number field
    private int itemNumber;
    // DVD title field
    private String DVDTitle;
    // number of units in stock
    private static int unitsInStock;
    // price per unit from stock
    private static double unitPrice;
    // DVD genre
    private static String genre;
    // restocking fee
    private double restockingFee;
    // default no argument constructor
    public DVDMovie(int itemNumber, String dvdTitle, int unitsInStock, double unitPrice, String genre) {
        this.itemNumber = 0;
        this.DVDTitle = "unknown";
        DVDMovie.unitsInStock = 0;
        DVDMovie.unitPrice = 0;
        this.setGenre("unknown");
    }
        /**
     * Argument constructor to initialize the object with passed values
     * 
     * @param itemNumber
     * @param DVDTitle
     * @param unitsInStock
     * @param unitPrice
     */
    public DVDMovie(int itemNumber, String DVDTitle, int unitsInStock, double unitPrice) {
        this.itemNumber = itemNumber;
        this.DVDTitle = DVDTitle;
        DVDMovie.unitsInStock = unitsInStock;
        DVDMovie.unitPrice = unitPrice;
    }
    // calculates inventory value for this product
    public static double getInventoryValue() {
        return unitPrice * unitsInStock;
    }
    //
    // Accessors and Mutator for Class fields
    //
    public int getItemNumber() {
        return itemNumber;
    }
    public void setItemNumber(int itemNumber2) {
        this.itemNumber = itemNumber2;
    }
    public String getDVDTitle() {
        return DVDTitle;
    }
    public void setDVDTitle(String DVDTitle) {
        this.DVDTitle = DVDTitle;
    }
    public int getUnitsInStock() {
        return unitsInStock;
    }
    public void setUnitsInStock(int unitsInStock) {
        DVDMovie.unitsInStock = unitsInStock;
    }
    public double getUnitPrice() {
        return unitPrice;
    }
    public void setUnitPrice(double unitPrice) {
        DVDMovie.unitPrice = unitPrice;
    }
    public double getInventoryValue1() {
        double value = getInventoryValue();
        // Add 5% restocking fee
        value = value + getRestockingFee();
        return value;
    }
    // Restocking fee is 5% of value
    public static double getRestockingFee() {
        double value = getInventoryValue();
        return value * 0.05;
    }
    /**
     * @param restockingFee the restockingFee to set
     */
    public void setRestockingFee(double restockingFee) {
        this.restockingFee = restockingFee;
    }

    /**
     * @return the genre
     */
    public static String getGenre() {
        return genre;
    }
    /**
     * @param genre the genre to set
     */
    public void setGenre(String genre) {
        DVDMovie.genre = genre;
    }
    public static String totalInvValue() {
        // TODO Auto-generated method stub
        return null;
    }
}

Here are the erros I'm getting now:

The value of the field DVDMovie.restockingFee is not used   DVDMovie.java   /DVDInventory   line 13 

The method setText(String) in the type JTextComponent is not applicable for the arguments (double)  Inventory.java  /DVDInventory   line 307    

The method getRestockingFee() is undefined for the type Inventory   Inventory.java  /DVDInventory   line 311

The method totalInvValue() is undefined for the type Inventory  Inventory.java  /DVDInventory   line 312    

The static method getInventoryValue() from the type DVDMovie should be accessed in a static way Inventory.java  /DVDInventory   line 175    

The method setText(String) in the type JTextComponent is not applicable for the arguments (double)  Inventory.java  /DVDInventory   line 306    

In Inventory,

change line 306,

// Change from:
// unitPriceText.setText(DVD.getUnitPrice());

// To:
unitPriceText.setText(Double.toString(DVD.getUnitPrice()));

change line 307,
from:

// Change from:
//invValueText.setText(DVDMovie.getInventoryValue());`

// To:
invValueText.setText(Double.toString(DVDMovie.getInventoryValue()));

change line 312,

// Change from:
// restockingFeeText.setText(DVDMovie.getRestockingFee());

// To:
restockingFeeText.setText(Double.toString(DVDMovie.getRestockingFee()));

In addItem (line 217-218), you do the following:

// number should be greater then previous
        int lastElementIndex = movieArray.length - 1;
        int lastItemNumber = movieArray[lastElementIndex].getItemNumber();

However, you've previously sorted the array by "DVDTitle", in "sortProducts". Therefore, movieArray[movieArray.length - 1].itemNumber is not necessarily the DVD with the highest item number any more.

In DVDMovie,
lines 16-20 are hard-coded. You need to put your parameter values.

// Change from:
// this.itemNumber = 0;
//this.DVDTitle = "unknown";
//DVDMovie.unitsInStock = 0;
//DVDMovie.unitPrice = 0;
//this.setGenre("unknown");

this.itemNumber = itemNumber;
this.DVDTitle = dvdTitle;
DVDMovie.unitsInStock = unitsInStock;
DVDMovie.unitPrice = unitPrice;
this.setGenre(genre);

There may be more issues, but this should help.

Inventory,

Alternatively,
In addItem,

instead of copying the array yourself:

for (int i = 0; i < movieArray.length; i++) {
            existingArray[i] = movieArray[i];
        }
        int newSize = existingArray.length + 1;
        movieArray = new DVDMovie[newSize];
        for (int i = 0; i < existingArray.length; i++) {
            movieArray[i] = existingArray[i];
        }
        movieArray[newSize - 1] = product;

you could do the following:

//System.arraycopy(copyFrom, 0, copyTo, 0, copyFrom.length);
        System.arraycopy(movieArray,0,existingArray,0,movieArray.length); //copy to a temp array
        movieArray = new DVDMovie[movieArray.length + 1]; //resize movieArray
        System.arraycopy(existingArray,0,movieArray,0,existingArray.length); //copy back to movieArray
        movieArray[movieArray.length - 1] = product;

I've added some println statements to the following code, to help you with runtime debugging:

Inventory:

sortProducts

   /**
     * This method is used to sort the products by DVD Title
     *
     * @param movieArray
     */
    private static void sortProducts(DVDMovie[] movieArray) {
        int length = movieArray.length;
        DVDMovie obj1 = null;
        DVDMovie obj2 = null;
        DVDMovie temp = null;

        //------------------------------------
        //add println statements for debugging
        //------------------------------------
        System.out.println("Before:");
        for (int p=0; p < length; p++)
        {
            System.out.println("itemNum: " +  movieArray[p].getItemNumber() + " Title: " + movieArray[p].getDVDTitle() );
        }//for

        //------------------------------------

        for (int i = 1; i < length; i++) {
            for (int j = 0; j < length - i; j++) {
                obj1 = movieArray[j];
                obj2 = movieArray[j + 1];
                if (obj1.getDVDTitle().compareTo(obj2.getDVDTitle()) > 0) {
                    temp = obj1;
                    movieArray[j] = movieArray[j + 1];
                    movieArray[j + 1] = temp;
                }
            }
        }


        //------------ ------------------------
        //add println statements for debugging
        //-------------------------------------
        System.out.println();
        System.out.println("After:");
        for (int q=0; q < length; q++)
        {
            System.out.println("itemNum: " +  movieArray[q].getItemNumber() + " Title: " + movieArray[q].getDVDTitle() );
        }//for

        //------------------------------------
    }

AddItem

    /**
     * This method is used to add the DVD
     */
    public void addItem() {
        // number should be greater then previous
        int lastElementIndex = movieArray.length - 1;
        int lastItemNumber = movieArray[lastElementIndex].getItemNumber();
        int newItemNumber = lastItemNumber + 1;
        String title = getDVDTitle();
        int numberOfUnits = getNumberOfItems();
        double unitPrice = getUnitPrice();
        String genre = getgenre();

        //------------ ------------------------
        //add println statements for debugging
        //-------------------------------------
        System.out.println();
        System.out.println("lastElementIndex: " + lastElementIndex);
        System.out.println("lastItemNumber: " + lastItemNumber);        
        System.out.println("item #: " + newItemNumber + "  title: " + title);

        //-------------------------------------

        DVDMovie product = null;
        if (null != genre && genre.trim().length() > 0) {
            product = new DVDMovie(newItemNumber, title, numberOfUnits, unitPrice, genre);
        } else {
            product = new DVDMovie(newItemNumber, title, numberOfUnits, unitPrice);
        }
        DVDMovie[] existingArray = new DVDMovie[movieArray.length];

        /*
         //System.arraycopy(copyFrom, 0, copyTo, 0, copyFrom.length);
        System.arraycopy(movieArray,0,existingArray,0,movieArray.length); //copy to a temp array
        movieArray = new DVDMovie[movieArray.length + 1]; //resize movieArray
        System.arraycopy(existingArray,0,movieArray,0,existingArray.length); //copy back to movieArray
        movieArray[movieArray.length - 1] = product;
        */


        for (int i = 0; i < movieArray.length; i++) {
            existingArray[i] = movieArray[i];
        }
        int newSize = existingArray.length + 1;
        movieArray = new DVDMovie[newSize];
        for (int i = 0; i < existingArray.length; i++) {
            movieArray[i] = existingArray[i];
        }
        movieArray[newSize - 1] = product;



        JOptionPane.showMessageDialog(null, "Movie added successfully!");
        position = movieArray.length - 1;
    }

Inventory
I noticed the "Cancel" button doesn't work on your JOptionPane.showInputDialog. Try something like the following:

getDVDTitle

  private String getDVDTitle() {

        //--------------------------------------
        // Changed from:
        //--------------------------------------


        /*
        String title = JOptionPane.showInputDialog("Enter DVD Title: ");

        while (title == null || title.trim().equals("")) {
            JOptionPane
                    .showMessageDialog(null, "Please enter DVD title.");
            title = JOptionPane.showInputDialog("Enter DVD Title: ");
        }
        */


        //--------------------------------------
        // Note: value is null if user clicked cancel
        //
        // Changed To:
        //--------------------------------------

        String title = "";

        while (title.equalsIgnoreCase("")) { //OK pressed without input
            title = JOptionPane.showInputDialog("Enter DVD Title: ");

            if (title == null) //cancel was clicked
            {
                return null;
            }
            else if (title.equalsIgnoreCase("")) { //OK pressed without input

                JOptionPane
                    .showMessageDialog(null, "Please enter DVD title.");
            }//else if
            else //valid data
            {
               // do nothing, it will exit, and return below
            }//else

        }//while


        return title;
    }

Then in AddItem

  /**
     * This method is used to add the DVD
     */
    public void addItem() {

        // number should be greater then previous
        int lastElementIndex = movieArray.length - 1;
        int lastItemNumber = movieArray[lastElementIndex].getItemNumber();
        int newItemNumber = lastItemNumber + 1;

        String title = getDVDTitle();

        //--------------------------------------
        // value is null if user clicked cancel
        //--------------------------------------

        if (title == null){
            return; //user canceled, so return
        }

        //--------------------------------------
        // TO DO: Make cancel button work for 
        //        the other ones
        //--------------------------------------

        int numberOfUnits = getNumberOfItems();
        double unitPrice = getUnitPrice();
        String genre = getgenre();

        //--------------------------------------

        System.out.println();
        System.out.println("lastElementIndex: " + lastElementIndex);
        System.out.println("lastItemNumber: " + lastItemNumber);        
        System.out.println("item #: " + newItemNumber + "  title: " + title);


        DVDMovie product = null;
        if (null != genre && genre.trim().length() > 0) {
            product = new DVDMovie(newItemNumber, title, numberOfUnits, unitPrice, genre);
        } else {
            product = new DVDMovie(newItemNumber, title, numberOfUnits, unitPrice);
        }
        DVDMovie[] existingArray = new DVDMovie[movieArray.length];

        /*
         //System.arraycopy(copyFrom, 0, copyTo, 0, copyFrom.length);
        System.arraycopy(movieArray,0,existingArray,0,movieArray.length); //copy to a temp array
        movieArray = new DVDMovie[movieArray.length + 1]; //resize movieArray
        System.arraycopy(existingArray,0,movieArray,0,existingArray.length); //copy back to movieArray
        movieArray[movieArray.length - 1] = product;
        */


        for (int i = 0; i < movieArray.length; i++) {
            existingArray[i] = movieArray[i];
        }
        int newSize = existingArray.length + 1;
        movieArray = new DVDMovie[newSize];
        for (int i = 0; i < existingArray.length; i++) {
            movieArray[i] = existingArray[i];
        }
        movieArray[newSize - 1] = product;



        JOptionPane.showMessageDialog(null, "Movie added successfully!");
        position = movieArray.length - 1;
    }

*Note: Runtime issues still exist (such as movieArray[movieArray.length - 1].itemNumber not necessarily being the DVD with the highest item number which may result in duplicate itemNumber).

Inventory

In **searchProduct **
you ask for the itemNumber, but in the following code:

for (int i = 0; i < movieArray.length; i++) {
            if (searchDVDTitle == movieArray[i].getDVDTitle()) {

you are comparing the title not itemNumber. Also, in the above statement:

`searchDVDTitle`

should be changed to

`DVDTitle`

because "DVDTitle" contains the user input.

Be careful with using the same variable name in different methods and assigning it a different type, because it may lead to confusion. In deleteItem, 'searchDVDTitle' is of type int. While in displayDVD, it is of type String.

Also, I recommend that you adopt a way for distinguishing between global variables and local variables. It can help to eliminate runtime errors.

even more important:

since I assume DVDTitle and the return type of getDVDTitle() are both String instances,

for (int i = 0; i < movieArray.length; i++) {
            if (searchDVDTitle == movieArray[i].getDVDTitle()) {

is not the right way to compare them. do realize, that while == MIGHT return the correct result, on the other hand, it might not.

always compare the value of two Object instances with the equals method.

The issue of displaying the data in the textfields.

Inventory

actionPerformed
You haven't called 'displayDVD' -- it is commented out. Uncomment it.

// button pushes...
    // // Sets the void for the next-button click
    public void actionPerformed(ActionEvent event) {
        if (event.getSource() == firstButton) {
            position = 0;
        } else if (event.getSource() == lastButton) {
            position = movieArray.length - 1;
        } else if (event.getSource() == previousButton) {
            if (position != 0) {
                position--;
            } else {
                position = movieArray.length - 1;
            }
        } else if (event.getSource() == nextButton) {
            if (position != (movieArray.length - 1)) {
                position++;
            } else {
                position = 0;
            }
        } else if (event.getSource() == modifyButton) {
            modifyItem();
        } else if (event.getSource() == addButton) {
            addItem();
            position = movieArray.length - 1;
        } else if (event.getSource() == deleteButton) {
            deleteItem();
        } else if (event.getSource() == searchButton) {
            searchProduct();
        } else if (event.getSource() == saveButton) {
            writeToFile();
        }

       //-------------------------------------------
       // Needs to be uncommented to display the DVD
       //-------------------------------------------
       displayDVD(); 
    }

Also, you really should use parameters when possible, instead of global variables.

Use this:

public void displayDVD(int position) {
    DVDMovie DVD = movieArray[position];

                 ...
}

Instead of:

public void displayDVD() {
    DVDMovie DVD = movieArray[position];

                 ...
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.