The Java code I am writing is required to have the first, next, previous, and last buttons, and my program still needs to sort. I believe there is something wrong in my codes for each button. I currently have this (of course with each "" for each button. Any ideas how I can get the buttons to work properly and still keep my sorting function. Or just have each button do what they should do. After I click on the last button, and view the last DVD, the next button is supposed to take the GUI back to the beginning of the index.

package guiinventoryprogram;

/** Program: Inventory Program
 *  File: InventoryProgram.java
 *  Summary: Inventory program that gives the name of the movie, the quanity in stock, the price, and the item number
 *  Author: Garvis Hopwood
 *  Date: August, 4 2011
 */

import java.awt.GridLayout;       // required to create a grid layout

import java.awt.BorderLayout;     // required to create a border layout

import java.awt.event.ActionEvent; // required for click events

import java.awt.event.ActionListener; // required for click events

import javax.swing.JPanel;  // required to create panels

import javax.swing.JFrame;  // required to use the frame

import javax.swing.JButton;  // required to create buttons

import javax.swing.JLabel;  // required to create text fields

import javax.swing.JTextField; // required to create text fields

import java.util.Arrays;  // required to sort array

import java.text.DecimalFormat;

import javax.swing.ImageIcon;

public class GUIInventoryProgram extends JFrame implements ActionListener

{

      // Declare Class Variables      

      //Declare two panels. gridPanel is main panel. panel is inserted into gridPanel.

      private JPanel gridPanel = new JPanel(); // one panel that contains my gridlayout.

      private JPanel panel = new JPanel(); // panel used to contain buttons, labels and text fields

      // Declare buttons

      JButton firstButton; // first button

      JButton nextButton; // next button

      JButton previousButton; // previous button

      JButton lastButton; // last button

      // Declare Text Fields

      JTextField TitleField; // Dvd Title

      JTextField UnitsField; // Units Field

      JTextField ItemNumberField; // Item Number field

      JTextField PriceField; // Dvd Price field

      JTextField ValueField;  // Value field
      
      JTextField DirectorField;
      

      // Declare Labels

      JLabel lblTitle; // Title label

      JLabel lblUnits; // Units Label

      JLabel lblItemNumber; // Item Number label

      JLabel lblPrice; // Price Label

      JLabel lblValue;  // Value of DVDs Label
      
      JLabel lblDirector;

      // Declare 5 Dvd Objecs

      Dvd dvd1;

      Dvd dvd2;

      Dvd dvd3;

      Dvd dvd4;

      Dvd dvd5;
      
      private static final int MAX_dvds = 5; // set maximum size for DVD Array

      Dvd[] dvd = new Dvd[MAX_dvds]; // create Dvd Array object
      
      DecimalFormat formatter = new DecimalFormat("$##,###.00");
      
      private static DecimalFormat currency = new DecimalFormat("$#,##0.00");

      private static int ArrayIndex = 0; // array index

      public GUIInventoryProgram() // constructor

      {

        MovieDirector d1 = new MovieDirector("Transformers", 7, 1002, 19.98, "Michael Bay");
        // Creates an instance of the DVD class and initialize class instance variables
        MovieDirector d2 = new MovieDirector("Green Mile", 3, 542, 14.50, "Frank Darabont");
        // Creates an instance of the DVD class and initialize class instance variables
        MovieDirector d3 = new MovieDirector("Lord of the Rings", 5, 937, 24.98, "Peter Jackson");
        // Creates an instance of the DVD class and initialize class instance variables
        MovieDirector d4 = new MovieDirector("Jar Head", 2, 865, 9.75, "Sam Mendes");
        // Creates an instance of the DVD class and initialize class instance variables
        MovieDirector d5 = new MovieDirector("Inception", 6, 1157, 21.97, "Christopher Nolan");
        // Creates an instance of the DVD class and initialize class instance variables
        

        // adding Dvd objects to the array
        dvd[0] = d1; // adding Transformers to the array of dvds
        dvd[1] = d2; // adding Green Mile to the array of dvds 
        dvd[2] = d3; // adding Lord of the Rings to the array of dvds
        dvd[3] = d4; // adding Jar Head to the array of dvds
        dvd[4] = d5; // adding Inception to the array of dvds
        
        Dvd.sortByTitle(dvd);  // sort the array by name of title


            gridPanel.setLayout(new BorderLayout()); // create a border layout

            gridPanel.add(this.createLabelPanel(), BorderLayout.WEST); // add label panel

            gridPanel.add(this.createTextPanel(), BorderLayout.CENTER); // add field panel

            gridPanel.add(this.createButtonPanel(), BorderLayout.SOUTH); // add button panel

            add(gridPanel);

      }
     
      // helper method creates a panel for the button 

      private JPanel createButtonPanel()

      {

           // ActionListener btnListen = new ButtonListener(); // create listener

             // create button objects

            firstButton = new JButton("First"); // create button object

            firstButton.setActionCommand("First"); // add actionCommand

            firstButton.addActionListener(this); // add Listener command
          
            nextButton = new JButton("Next"); // create button object

            nextButton.setActionCommand("Next"); // add actionCommand

            nextButton.addActionListener(this); // add Listener command
            
            previousButton = new JButton("Previous"); // create button object

            previousButton.setActionCommand("Previous"); // add actionCommand

            previousButton.addActionListener(this); // add Listener command
 
            lastButton = new JButton("Last"); // create button object

            lastButton.setActionCommand("Last"); // add actionCommand

            lastButton.addActionListener(this); // add Listener command
            

            // create panel object

            JPanel panel = new JPanel();

 

            panel.add(firstButton); // add firt button to panel

            panel.add(nextButton); // add next button to panel

            panel.add(previousButton); // add previous button to panel

            panel.add(lastButton); // add last button to panel
            
            return panel; // return panel

      } // end createButtonPanel method

      private JPanel createLabelPanel()

      {

            // create instance of label objects
            ImageIcon icon = new ImageIcon("/Users/garvishopwood/NetBeansProjects/GUIInventoryProgram/src/home.jpg");   // load the image file
            
            JLabel lblLogo = new JLabel(icon); // add the image to the label
            

            lblTitle = new JLabel("Title:"); // label for Title of DVD

            lblUnits = new JLabel("Units:"); // label for Units in stock for DVD

            lblItemNumber = new JLabel("Item Number:"); // label for DVD Item Number

            lblPrice = new JLabel("Price:"); // label for price of DVD

            lblValue = new JLabel("Value of Items:"); // lable for value of DVD
            
            lblDirector = new JLabel ("Directors Name:");

            panel = new JPanel();

            panel.setLayout(new GridLayout(10, 1));

            // add labels to the panel
            panel.add(lblLogo);

            panel.add(lblTitle);

            panel.add(lblUnits);

            panel.add(lblItemNumber);

            panel.add(lblPrice);

            panel.add(lblValue);
            
            panel.add(lblDirector);

            return panel;

      } // end createLabelPanel method

      private JPanel createTextPanel()

      {

            //create instances of text box objects
            JLabel lblCompanyName = new JLabel("      DVD Blowout");

            TitleField = new JTextField(); // Title text field

            TitleField.setEditable(false);  // set field to not editable to prevent user from changing the data

            UnitsField = new JTextField(); // Units text field

            UnitsField.setEditable(false);  // set field to not editable to prevent user from changing the data

            ItemNumberField = new JTextField(); // Item Number field

            ItemNumberField.setEditable(false);  // set field to not editable to prevent user from changing the data

            PriceField = new JTextField();   // Price text field

            PriceField.setEditable(false);   // set field to not editable to prevent user from changing the data

            ValueField = new JTextField();    // Value text field to sum the total of the DVDs value.

            ValueField.setEditable(false);   // set field to not editable to prevent user from changing the data
            
            DirectorField = new JTextField();
            
            DirectorField.setEditable(false);


            panel = new JPanel(); // create panel object

            panel.setLayout(new GridLayout(10, 1)); // create grid layout for fields.
            
            panel.add(lblCompanyName);   // logo field

            panel.add(TitleField); // add the Title field to the grid layout

            panel.add(UnitsField); // add the Units field to the grid layout

            panel.add(ItemNumberField); // add the Item Number field to the grid layout

            panel.add(PriceField); // add the Price field to the grid layout

            panel.add(ValueField); // add the total value field to the grid layout
            
            panel.add(DirectorField);

            return panel; // return the panel

      } // end createTextPanel method

 
            @ Override public void actionPerformed(ActionEvent e)

            {                 

                  // add button functions

                        if (e.getActionCommand() == "First") // if First button is clicked                    
                        if (ArrayIndex < dvd.length) 

                        {

                              TitleField.setText(dvd[ArrayIndex].getDvdTitle()); // get the Dvds title

                              // and assign it the name text field.

                              UnitsField.setText(String.valueOf(dvd[ArrayIndex].getDvdUnits())); 
                              // get the units in stock and assign it the Units text field.

                              ItemNumberField.setText(String.valueOf(dvd[ArrayIndex].getDvdItemNumber()));

                              // get Dvds item number and assign it the item number text field.                              
                              
                              PriceField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdPrice()));

                              // get the Price of the DVD and assign it the price text field.

                              ValueField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdValue() + dvd[ArrayIndex].getdvdRestockingfee()));  
                              // display the sum of the total of the DVDs in stock
                              
                              DirectorField.setText(String.valueOf(dvd[ArrayIndex].getdvdDirector()));
                              // display the Directors name of the DVD

                              ArrayIndex = ArrayIndex + 1; // increment the array index to get to the next value
                              
                              

                        } // end if
                        if (e.getActionCommand() == "Next") // if Next button is clicked

                     
                        if (ArrayIndex < dvd.length) 

                        {

                              TitleField.setText(dvd[ArrayIndex].getDvdTitle()); // get the Dvds title

                              // and assign it the name text field.

                              UnitsField.setText(String.valueOf(dvd[ArrayIndex].getDvdUnits())); 
                              // get the units in stock and assign it the Units text field.

                              ItemNumberField.setText(String.valueOf(dvd[ArrayIndex].getDvdItemNumber()));

                              // get Dvds item number and assign it the item number text field.                              
                              
                              PriceField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdPrice()));

                              // get the Price of the DVD and assign it the price text field.

                              ValueField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdValue() + dvd[ArrayIndex].getdvdRestockingfee()));  
                              // display the sum of the total of the DVDs in stock
                              
                              DirectorField.setText(String.valueOf(dvd[ArrayIndex].getdvdDirector()));
                              // display the Directors name of the DVD

                              ArrayIndex = ArrayIndex + 1; // increment the array index to get to the next value
                              
                              

                        } // end if
                                  
                        if (e.getActionCommand() == "Previous") // if Previous button is clicked

                     
                        if (ArrayIndex < dvd.length) 

                        {

                              TitleField.setText(dvd[ArrayIndex].getDvdTitle()); // get the Dvds title

                              // and assign it the name text field.

                              UnitsField.setText(String.valueOf(dvd[ArrayIndex].getDvdUnits())); 
                              // get the units in stock and assign it the Units text field.

                              ItemNumberField.setText(String.valueOf(dvd[ArrayIndex].getDvdItemNumber()));

                              // get Dvds item number and assign it the item number text field.                              
                              
                              PriceField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdPrice()));

                              // get the Price of the DVD and assign it the price text field.

                              ValueField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdValue() + dvd[ArrayIndex].getdvdRestockingfee()));  
                              // display the sum of the total of the DVDs in stock
                              
                              DirectorField.setText(String.valueOf(dvd[ArrayIndex].getdvdDirector()));
                              // display the Directors name of the DVD

                              ArrayIndex = ArrayIndex + 1; // increment the array index to get to the next value
                              
                              

                        } // end if
                                                   
                        if (e.getActionCommand() == "Last") // if Last button is clicked
                     
                        if (ArrayIndex < dvd.length) 

                        {

                              TitleField.setText(dvd[ArrayIndex].getDvdTitle()); // get the Dvds title

                              // and assign it the name text field.

                              UnitsField.setText(String.valueOf(dvd[ArrayIndex].getDvdUnits())); 
                              // get the units in stock and assign it the Units text field.

                              ItemNumberField.setText(String.valueOf(dvd[ArrayIndex].getDvdItemNumber()));

                              // get Dvds item number and assign it the item number text field.                              
                              
                              PriceField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdPrice()));

                              // get the Price of the DVD and assign it the price text field.

                              ValueField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdValue() + dvd[ArrayIndex].getdvdRestockingfee()));  
                              // display the sum of the total of the DVDs in stock
                              
                              DirectorField.setText(String.valueOf(dvd[ArrayIndex].getdvdDirector()));
                              // display the Directors name of the DVD

                              ArrayIndex = ArrayIndex + 1; // increment the array index to get to the next value
                              
                              

                        } // end if

                 
            } // end actionPerformed

    public static void main(String[] args)

      {

            JFrame frame = new GUIInventoryProgram(); // creat a frame object

            frame.setSize(400, 400); // set the size of the window - 400 is width, 400 is height

            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // close the application

            frame.setTitle("DVD Inventory"); // set the title of the window

            frame.setLocationRelativeTo( null );  // center the form

            frame.setVisible(true); // display form

      } // end main

 

} // end GUIInventoryProgram class
package guiinventoryprogram;

class Dvd {
    // declare instance variables
    private String dvdTitle; //title of dvd
    private int dvdUnits; // number of units of the dvd
    private double dvdItemNumber; // item number of the dvd
    private double dvdPrice; // Price of the dvd
    private String dvdDirector;
    public Dvd()
    {
    }
    //declare DVD constructor that shows title, stock, item, and price
    public Dvd(String Title, int Units, double ItemNumber, double Price, String Director) {
    //call to Object constructor occurs here
        dvdTitle = Title;
        dvdUnits = Units;
        dvdItemNumber = ItemNumber;
        dvdPrice = Price;
        dvdDirector = Director;
        
    } //end four-argument constructor
    
    //set DVD name
    public void setdvdTitle(String Title) {
        setdvdTitle(Title);
    } //end method setDvdTitle

    //return dvd Title
    public String getDvdTitle() {
    return dvdTitle;
    } //end method getDvdTitle

    //set Dvd stock
    public void setDvdUnits(int Units) {
    dvdUnits = (Units < 0) ? 0 : Units;
    } //end method setDvdStock

    //return dvd stock
    public double getDvdUnits() {
    return dvdUnits;
    } //end method getDvdStock

    public void setDvdItemNumber(double ItemNumber) {
    dvdItemNumber = (ItemNumber < 0.0) ? 0.0 : ItemNumber;
    } //end method set dvd Item

    //return dvd item
    public double getDvdItemNumber() {
    return dvdItemNumber;
    } //end method getDvdItem

    public void setDvdPrice(double Price) {
    dvdPrice = (Price < 0.0) ? 0.0 : Price;
    } //end method SetDvdPrice

    //return dvd price
    public double getDvdPrice() {
    return dvdPrice;
    } //end method get Dvd Price

    // calculate inventory value
    public double getDvdValue() {
    return  getDvdPrice() * dvdUnits;
    } //end method value
    
        public double getdvdRestockingfee() {
        return getDvdValue() * .05;
    }
    
    public void setdvdDirector(String Director) {
    setdvdDirector(Director);
    } //end method setDvdTitle

    //return dvd Title
    public String getdvdDirector() {
    return dvdDirector;
    } //end method getDvdTitle
    

        public static void sortByTitle(Dvd dvd[])
    {    // sort the dvd by title
        Dvd temp;
        for(double j = dvd.length - 2; j >= 0; j--)
                for(int i = 0 ; i <= j ; i++)
                    if(dvd [ i ].getDvdTitle().compareTo(dvd[ i + 1 ].getDvdTitle())>0)
                    {
                    temp=dvd[ i ];
                    dvd[ i ] = dvd[ i + 1 ];
                    dvd[ i + 1 ] = temp;
                    }

                } // end sort by title method

} // end class dvd
package guiinventoryprogram;

class MovieDirector extends Dvd{
    private String dvdDirector;
    private double  Restockingfee;
    
    public MovieDirector(String Title, int Units, double ItemNumber, double Price, String Director)
    {
        super(Title, Units, ItemNumber, Price, Director);
        this.dvdDirector = Director;
        this.Restockingfee = Restockingfee;
        
    }

        public String getDirector() {
        return dvdDirector;
    }

        public void setDirector(String Director) {
        this.dvdDirector = Director;
    }
    

    public double getRestockingfee() {
        return getDvdValue() * 0.05;
    }    
        public void setRestockingfee (double Restockingfee){
        this.Restockingfee = Restockingfee;
        }
}

your problem is in MovieDirector class constructor takes wrong parameters

public MovieDirector(String Title, int Units,
            double ItemNumber, double Price, String Director) {

change

double ItemNumber

to the

int ItemNumber

minor changes

public class MovieDirector extends Dvd {

    private String dvdDirector;
    private double Restockingfee;

    public MovieDirector(String Title, int Units,
            int ItemNumber, double Price, String Director) {
        super(Title, Units, ItemNumber, Price, Director);
        this.dvdDirector = Director;
        this.Restockingfee = Restockingfee;
    }

    public String getDirector() {
        return dvdDirector;
    }

    public void setDirector(String Director) {
        this.dvdDirector = Director;
    }

    public double getRestockingfee() {
        return getDvdValue() * 0.05;
    }

    public void setRestockingfee(double Restockingfee) {
        this.Restockingfee = Restockingfee;
    }
}
public class Dvd {
    // declare instance variables

    private String dvdTitle; //title of dvd
    private int dvdUnits; // number of units of the dvd
    private double dvdItemNumber; // item number of the dvd
    private double dvdPrice; // Price of the dvd
    private String dvdDirector;

    public Dvd() {
    }
    //declare DVD constructor that shows title, stock, item, and price

    public Dvd(String Title, int Units, double ItemNumber, double Price, String Director) {        
        dvdTitle = Title;//call to Object constructor occurs here
        dvdUnits = Units;
        dvdItemNumber = ItemNumber;
        dvdPrice = Price;
        dvdDirector = Director;

    } //end four-argument constructor

    //set DVD name
    public void setdvdTitle(String Title) {
        setdvdTitle(Title);
    } //end method setDvdTitle

    //return dvd Title
    public String getDvdTitle() {
        return dvdTitle;
    } //end method getDvdTitle

    //set Dvd stock
    public void setDvdUnits(int Units) {
        dvdUnits = (Units < 0) ? 0 : Units;
    } //end method setDvdStock

    //return dvd stock
    public double getDvdUnits() {
        return dvdUnits;
    } //end method getDvdStock

    public void setDvdItemNumber(double ItemNumber) {
        dvdItemNumber = (ItemNumber < 0.0) ? 0.0 : ItemNumber;
    } //end method set dvd Item

    //return dvd item
    public double getDvdItemNumber() {
        return dvdItemNumber;
    } //end method getDvdItem

    public void setDvdPrice(double Price) {
        dvdPrice = (Price < 0.0) ? 0.0 : Price;
    } //end method SetDvdPrice

    //return dvd price
    public double getDvdPrice() {
        return dvdPrice;
    } //end method get Dvd Price

    // calculate inventory value
    public double getDvdValue() {
        return getDvdPrice() * dvdUnits;
    } //end method value

    public double getdvdRestockingfee() {
        return getDvdValue() * .05;
    }

    public void setdvdDirector(String Director) {
        setdvdDirector(Director);
    } //end method setDvdTitle

    //return dvd Title
    public String getdvdDirector() {
        return dvdDirector;
    } //end method getDvdTitle

    public static void sortByTitle(Dvd dvd[]) {    // sort the dvd by title
        Dvd temp;
        for (double j = dvd.length - 2; j >= 0; j--) {
            for (int i = 0; i <= j; i++) {
                if (dvd[i].getDvdTitle().compareTo(dvd[i + 1].getDvdTitle()) > 0) {
                    temp = dvd[i];
                    dvd[i] = dvd[i + 1];
                    dvd[i + 1] = temp;
                }
            }
        }

    } // end sort by title method
}
import java.awt.GridLayout;       // required to create a grid layout
import java.awt.BorderLayout;     // required to create a border layout
import java.awt.event.ActionEvent; // required for click events
import java.awt.event.ActionListener; // required for click events
import javax.swing.JPanel;  // required to create panels
import javax.swing.JFrame;  // required to use the frame
import javax.swing.JButton;  // required to create buttons
import javax.swing.JLabel;  // required to create text fields
import javax.swing.JTextField; // required to create text fields
import java.text.DecimalFormat;
import javax.swing.ImageIcon;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;

public class GUIInventoryProgram extends JFrame implements ActionListener {

    private static final long serialVersionUID = 1L;
    // Declare Class Variables      
    //Declare two panels. gridPanel is main panel. panel is inserted into gridPanel.
    private JPanel gridPanel = new JPanel(); // one panel that contains my gridlayout.
    private JPanel panel = new JPanel(); // panel used to contain buttons, labels and text fields
    // Declare buttons
    private JButton firstButton; // first button
    private JButton nextButton; // next button
    private JButton previousButton; // previous button
    private JButton lastButton; // last button
    // Declare Text Fields
    private JTextField TitleField; // Dvd Title
    private JTextField UnitsField; // Units Field
    private JTextField ItemNumberField; // Item Number field
    private JTextField PriceField; // Dvd Price field
    private JTextField ValueField;  // Value field
    private JTextField DirectorField;
    // Declare Labels
    private JLabel lblTitle; // Title label
    private JLabel lblUnits; // Units Label
    private JLabel lblItemNumber; // Item Number label
    private JLabel lblPrice; // Price Label
    private JLabel lblValue;  // Value of DVDs Label
    private JLabel lblDirector;
    // Declare 5 Dvd Objecs
    private Dvd dvd1;
    private Dvd dvd2;
    private Dvd dvd3;
    private Dvd dvd4;
    private Dvd dvd5;
    private static final int MAX_dvds = 5; // set maximum size for DVD Array
    private Dvd[] dvd = new Dvd[MAX_dvds]; // create Dvd Array object
    private DecimalFormat formatter = new DecimalFormat("$##,###.00");
    private static DecimalFormat currency = new DecimalFormat("$#,##0.00");
    private static int ArrayIndex = 0; // array index

    public GUIInventoryProgram() { // constructor 
        MovieDirector d1 = new MovieDirector("Transformers", 7, 1002, 19.98, "Michael Bay");
        // Creates an instance of the DVD class and initialize class instance variables
        MovieDirector d2 = new MovieDirector("Green Mile", 3, 542, 14.50, "Frank Darabont");
        // Creates an instance of the DVD class and initialize class instance variables
        MovieDirector d3 = new MovieDirector("Lord of the Rings", 5, 937, 24.98, "Peter Jackson");
        // Creates an instance of the DVD class and initialize class instance variables
        MovieDirector d4 = new MovieDirector("Jar Head", 2, 865, 9.75, "Sam Mendes");
        // Creates an instance of the DVD class and initialize class instance variables
        MovieDirector d5 = new MovieDirector("Inception", 6, 1157, 21.97, "Christopher Nolan");
        // Creates an instance of the DVD class and initialize class instance variables
        // adding Dvd objects to the array
        dvd[0] = d1; // adding Transformers to the array of dvds
        dvd[1] = d2; // adding Green Mile to the array of dvds 
        dvd[2] = d3; // adding Lord of the Rings to the array of dvds
        dvd[3] = d4; // adding Jar Head to the array of dvds
        dvd[4] = d5; // adding Inception to the array of dvds
        Dvd.sortByTitle(dvd);  // sort the array by name of title
        gridPanel.setLayout(new BorderLayout()); // create a border layout
        gridPanel.add(this.createLabelPanel(), BorderLayout.WEST); // add label panel
        gridPanel.add(this.createTextPanel(), BorderLayout.CENTER); // add field panel
        gridPanel.add(this.createButtonPanel(), BorderLayout.SOUTH); // add button panel
        add(gridPanel);
    }

    // helper method creates a panel for the button 
    private JPanel createButtonPanel() { // create button objects
        // ActionListener btnListen = new ButtonListener(); // create listener       
        firstButton = new JButton("First"); // create button object
        firstButton.setActionCommand("First"); // add actionCommand
        firstButton.addActionListener(this); // add Listener command
        nextButton = new JButton("Next"); // create button object
        nextButton.setActionCommand("Next"); // add actionCommand
        nextButton.addActionListener(this); // add Listener command
        previousButton = new JButton("Previous"); // create button object
        previousButton.setActionCommand("Previous"); // add actionCommand
        previousButton.addActionListener(this); // add Listener command
        lastButton = new JButton("Last"); // create button object
        lastButton.setActionCommand("Last"); // add actionCommand
        lastButton.addActionListener(this); // add Listener command       
        JPanel panel1 = new JPanel(); // create panel object
        panel1.add(firstButton); // add firt button to panel
        panel1.add(nextButton); // add next button to panel
        panel1.add(previousButton); // add previous button to panel
        panel1.add(lastButton); // add last button to panel
        return panel1; // return panel
    } // end createButtonPanel method

    private JPanel createLabelPanel() { // create instance of label objects       
        ImageIcon icon = new ImageIcon( // load the image file
                "/Users/garvishopwood/NetBeansProjects/GUIInventoryProgram/src/home.jpg");
        JLabel lblLogo = new JLabel(icon); // add the image to the label
        lblTitle = new JLabel("Title : "); // label for Title of DVD
        lblUnits = new JLabel("Units : "); // label for Units in stock for DVD
        lblItemNumber = new JLabel("Item Number : "); // label for DVD Item Number
        lblPrice = new JLabel("Price : "); // label for price of DVD
        lblValue = new JLabel("Value of Items : "); // lable for value of DVD
        lblDirector = new JLabel("Directors Name : ");
        panel = new JPanel();
        panel.setLayout(new GridLayout(10, 1, 5, 5));
        panel.setBorder(new EmptyBorder(2, 10, 2, 10));
        panel.add(lblLogo);// add labels to the panel
        panel.add(lblTitle);
        panel.add(lblUnits);
        panel.add(lblItemNumber);
        panel.add(lblPrice);
        panel.add(lblValue);
        panel.add(lblDirector);
        return panel;
    } // end createLabelPanel method

    private JPanel createTextPanel() {//create instances of text box objects        
        JLabel lblCompanyName = new JLabel("      DVD Blowout");
        TitleField = new JTextField(); // Title text field
        TitleField.setEditable(false);  // set field to not editable to prevent user from changing the data
        UnitsField = new JTextField(); // Units text field
        UnitsField.setEditable(false);  // set field to not editable to prevent user from changing the data
        ItemNumberField = new JTextField(); // Item Number field
        ItemNumberField.setEditable(false);  // set field to not editable to prevent user from changing the data
        PriceField = new JTextField();   // Price text field
        PriceField.setEditable(false);   // set field to not editable to prevent user from changing the data
        ValueField = new JTextField();    // Value text field to sum the total of the DVDs value.
        ValueField.setEditable(false);   // set field to not editable to prevent user from changing the data
        DirectorField = new JTextField();
        DirectorField.setEditable(false);
        panel = new JPanel(); // create panel object
        panel.setLayout(new GridLayout(10, 1, 5, 5)); // create grid layout for fields.
        panel.setBorder(new EmptyBorder(2, 10, 2, 10));
        panel.add(lblCompanyName);   // logo field
        panel.add(TitleField); // add the Title field to the grid layout
        panel.add(UnitsField); // add the Units field to the grid layout
        panel.add(ItemNumberField); // add the Item Number field to the grid layout
        panel.add(PriceField); // add the Price field to the grid layout
        panel.add(ValueField); // add the total value field to the grid layout
        panel.add(DirectorField);
        return panel; // return the panel
    } // end createTextPanel method

    @Override
    public void actionPerformed(ActionEvent e) { // add button functions 
        if (e.getActionCommand() == null ? "First" == null : e.getActionCommand().equals("First")) {// if First button is clicked        
            if (ArrayIndex < dvd.length) { // get the Dvds title
                TitleField.setText(dvd[ArrayIndex].getDvdTitle());
                // and assign it the name text field.
                UnitsField.setText(String.valueOf(dvd[ArrayIndex].getDvdUnits()));
                // get the units in stock and assign it the Units text field.
                ItemNumberField.setText(String.valueOf(dvd[ArrayIndex].getDvdItemNumber()));
                // get Dvds item number and assign it the item number text field. 
                PriceField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdPrice()));
                // get the Price of the DVD and assign it the price text field.
                ValueField.setText(String.format("$ %8.2f",
                        dvd[ArrayIndex].getDvdValue() + dvd[ArrayIndex].getdvdRestockingfee()));
                // display the sum of the total of the DVDs in stock
                DirectorField.setText(String.valueOf(dvd[ArrayIndex].getdvdDirector()));
                // display the Directors name of the DVD
                ArrayIndex += 1; // increment the array index to get to the next value
            } // end if
        }
        if (e.getActionCommand() == null ? "Next" == null : e.getActionCommand().equals("Next")) { // if Next button is clicked
            if (ArrayIndex < dvd.length) {// get the Dvds title
                TitleField.setText(dvd[ArrayIndex].getDvdTitle());
                // and assign it the name text field.
                UnitsField.setText(String.valueOf(dvd[ArrayIndex].getDvdUnits()));
                // get the units in stock and assign it the Units text field.
                ItemNumberField.setText(String.valueOf(dvd[ArrayIndex].getDvdItemNumber()));
                // get Dvds item number and assign it the item number text field. 
                PriceField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdPrice()));
                // get the Price of the DVD and assign it the price text field.
                ValueField.setText(String.format("$ %8.2f",
                        dvd[ArrayIndex].getDvdValue() + dvd[ArrayIndex].getdvdRestockingfee()));
                // display the sum of the total of the DVDs in stock
                DirectorField.setText(String.valueOf(dvd[ArrayIndex].getdvdDirector()));
                // display the Directors name of the DVD
                ArrayIndex += 1; // increment the array index to get to the next value
            } // end if
        }
        if (e.getActionCommand() == null ? "Previous" == null : e.getActionCommand().equals("Previous")) { // if Previous button is clicked       
            if (ArrayIndex < dvd.length) { // get the Dvds title
                TitleField.setText(dvd[ArrayIndex].getDvdTitle());
                // and assign it the name text field.
                UnitsField.setText(String.valueOf(dvd[ArrayIndex].getDvdUnits()));
                // get the units in stock and assign it the Units text field.
                ItemNumberField.setText(String.valueOf(dvd[ArrayIndex].getDvdItemNumber()));
                // get Dvds item number and assign it the item number text field. 
                PriceField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdPrice()));
                // get the Price of the DVD and assign it the price text field.
                ValueField.setText(String.format("$ %8.2f",
                        dvd[ArrayIndex].getDvdValue() + dvd[ArrayIndex].getdvdRestockingfee()));
                // display the sum of the total of the DVDs in stock
                DirectorField.setText(String.valueOf(dvd[ArrayIndex].getdvdDirector()));
                // display the Directors name of the DVD
                ArrayIndex += 1; // increment the array index to get to the next value
            } // end if
        }
        if (e.getActionCommand() == null ? "Last" == null : e.getActionCommand().equals("Last")) {// if Last button is clicked
            if (ArrayIndex < dvd.length) {
                TitleField.setText(dvd[ArrayIndex].getDvdTitle()); // get the Dvds title
                // and assign it the name text field.
                UnitsField.setText(String.valueOf(dvd[ArrayIndex].getDvdUnits()));
                // get the units in stock and assign it the Units text field.
                ItemNumberField.setText(String.valueOf(dvd[ArrayIndex].getDvdItemNumber()));
                // get Dvds item number and assign it the item number text field.  
                PriceField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdPrice()));
                // get the Price of the DVD and assign it the price text field.
                ValueField.setText(String.format("$ %8.2f", dvd[ArrayIndex].getDvdValue() + dvd[ArrayIndex].getdvdRestockingfee()));
                // display the sum of the total of the DVDs in stock
                DirectorField.setText(String.valueOf(dvd[ArrayIndex].getdvdDirector()));
                // display the Directors name of the DVD
                ArrayIndex += 1; // increment the array index to get to the next value
            } // end if
        }
    } // end actionPerformed

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                JFrame frame = new GUIInventoryProgram(); // creat a frame object
                frame.setSize(400, 400); // set the size of the window - 400 is width, 400 is height
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // close the application
                frame.setTitle("DVD Inventory"); // set the title of the window
                frame.setLocationRelativeTo(null);  // center the form
                frame.setVisible(true); // display form
            }
        });
    } // end main
}
commented: Great Job +5

check your ArrayIndex as well, you need to minus when u press previous

397   ArrayIndex = ArrayIndex + 1; // increment the array index to get to the next value

Also you need else if statement to jump on first.

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.