Hey there everyone, I am currently working on and Assignment that is due tonight and I feel like I am close but can not exactly get to the end. I would appreciate any feedback possible. Kinda stuck at the moment.
---Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the GUI should display the value of the entire inventory, the additional attribute, and the restocking fee.

---Modify the Inventory Program by adding a button to the GUI that allows the user to move to the first item, the previous item, the next item, and the last item in the inventory. If the first item is displayed and the user clicks on the Previous button, the last item should display. If the last item is displayed and the user clicks on the Next button, the first item should display

That is what I must finish and I will post the code I have so far beneath this.

{package prg215inv;

/**
 *
 * @author Cripop
 */

public class SpecialDVD extends DVD
{

    static int length() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    static Object get(int i) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    private String movieTitle;// title of the movie

    //Initialize constructor
    public SpecialDVD(int number, String name, int total, double price, String gen, String title)
    {
       super(number, name, total, price, gen);
       movieTitle = title;
    }

    //Method calculates the value for the amount of DVDs times the price per DVD

    public double getValue()
    {
        return dvdAmount * dvdPrice*1.05;
    }

    /**
     * @return the movieTitle
     */
    public String getMovieTitle()
    {
        return movieTitle;
    }

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

package prg215inv;

/**
 *
 * @author Cripop
 */

public class DVD implements Comparable<DVD>
{

    static int length() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    static Object get(int i) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public int dvdNumber; //product number
    public String dvdName; // product name
    public int dvdAmount; //product in stock
    public double dvdPrice; // price per unit
    public String genre;// Genre of the movie

    //Initialize constructor
    public DVD(int number, String name, int total, double price, String gen)
    {
        dvdNumber = number;
        dvdName = name;
        dvdAmount = total;
        dvdPrice = price;
        genre = gen;
    }
    //Method sets string genre

    public void setgenre(String gen)
    {
        genre = gen;
    }
    //Method returns string genre

    public String getgenre()
    {
        return genre;
    }
    //Method sets dvdNumber

    public void setdvdNumber(int number)
    {
        dvdNumber = number;
    }
    //Method returns dvdNumber

    public int getdvdNumber()
    {
        return dvdNumber;

    }
    //Method sets dvdName

    public void setdvdName(String name)
    {
        dvdName = name;
    }
    //Method returns dvdName

    public String getdvdName()
    {
        return dvdName;
    }
    //Method sets dvdAmount

    public void setdvdAmount(int total)
    {
        dvdAmount = (total = 0);
    }
    //Method returns dvdAmount

    public int getdvdAmount()
    {
        return dvdAmount;

    }
    //Method sets dvdPrice

    public void setdvdPrice(double price)
    {
        dvdPrice = (0);
    }
    //Method returns dvdPrice

    public double getdvdPrice()
    {
        return dvdPrice;
    }
    //Method calculates the value for the amount of DVDs times the price per DVD

    public double getValue()
    {
        return dvdAmount * dvdPrice;
    }
    //Method calculates the re-stocking fee

    //Helen: added
    public int compareTo(DVD o)
    {
        return this.getdvdName().compareToIgnoreCase(o.getdvdName());
    }
}

package prg215inv;

/**
 *
 * @author Cripop
 */
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;

public class dvdInv
{
    //Sets this the main method

    public static void main(String args[])
    {
        //Array containing the DVDs and all information pulled from the other "class"
        DVD[] object1 = new DVD[4]; //Helen: modified

        object1[0] = new DVD(1734, "Rambo", 20, 19.99, "Action");
        object1[1] = new DVD(1254, "Coach Carter", 15, 19.99, "Drama");
        object1[2] = new DVD(1137, "Star Wars", 8, 24.99, "Sci-Fi");

        //Helen: a special DVD
        object1[3] = new SpecialDVD(1138, "Star Wars 5", 8, 24.99, "Sci-Fi", "Super DVD"); //Helen: added


        //Print or "write" line
        System.out.println("Dvds we have in Stock");


        calculateInventory(object1);
    }


    public static void calculateInventory(DVD[] dvdList){
        double totalValue = 0;
        Arrays.sort(dvdList);

         //For loop counter to go through the array until it has gone through every element once
        for (int i = 0; i < dvdList.length; i++)
        {
            System.out.println(dvdList);
            // All print lines pulling information from the other class and it's methods.
            System.out.printf("%s %d \n", "Product number: ",
                    dvdList[i].getdvdNumber());

            System.out.printf("%s %s \n", "Dvd Name is:",
                    dvdList[i].getdvdName());

            System.out.printf("%s %d \n", "Amount in stock:",
                    dvdList[i].getdvdAmount());

            System.out.printf("%s %.02f \n", "Price per dvd : $",
                    dvdList[i].getdvdPrice());

            System.out.printf("%s %.02f \n", "Price for all in inventory : $",
                    dvdList[i].getValue()); 

            System.out.printf("%s %s \n", "The Genre is:",
                    dvdList[i].getgenre());

            totalValue += dvdList[i].getValue();
        }

            System.out.printf("**************The entire inventory value is %.02f********",
                    totalValue);

    }
}

    package prg215inv;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

/**
 *
 * @author Cripop
 */
public class Gui extends JFrame {

    private DVD object1;
    int currentIndex = 0;

    JTextField itemnumber = new JTextField();
    JTextField name = new JTextField();
    JTextField amount = new JTextField();
    JTextField price = new JTextField ();

    JTextField valueOfEntireInventory = new JTextField();

    JButton next = new JButton("Next");
    JButton previous = new JButton ("Previous");




        public Gui(SpecialDVD specialdvd){
            super("GUI Assignment");
            this.object1 = object1;
            setLayout(new FlowLayout());  
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


        pack();


        previous.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                showPrior();
            }

                private void showPrior() {
                    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
        });

        next.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                showNext();
            }

                private void showNext() {
                    throw new UnsupportedOperationException("Not supported yet.");
                }
        });



        }
}

I am having a hard part grasping the GUI part that I need to get to display the Array with. Thanks!

update the GUI part to where I am now. Still now getting it to work right.

package prg215inv;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

/**
 *
 * @author Cripop
 */
public class Gui extends JFrame {

    private DVD object1;
    private dvdInv object2;
    private SpecialDVD object3;

    int currentIndex = 0;

    JTextField itemNumber = new JTextField();
    JTextField name = new JTextField();
    JTextField amount = new JTextField();
    JTextField price = new JTextField ();
    JTextField genre = new JTextField();

    JTextField valueOfEntireInventory = new JTextField();

    JButton next = new JButton("Next");
    JButton previous = new JButton ("Previous");




        public Gui(SpecialDVD specialdvd){
            super("GUI Assignment");
            this.object1 = object1;
            setLayout(new FlowLayout());  
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                creatGUI();
        pack();


        previous.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                showPrior();
            }

                private void showPrior() {
                    throw new UnsupportedOperationException("Not supported yet.");
                }
        });

        next.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                showNext();
            }

                private void showNext() {
                    throw new UnsupportedOperationException("Not supported yet.");
                }
        });

                JPanel productPanel= new JPanel(new GridLayout(0,4,5,5));

                productPanel.add(new JLabel("Dvd Number: "));
                productPanel.add(itemNumber);

                productPanel.add(new JLabel("Dvd Name: "));
                productPanel.add(name);

                productPanel.add(new JLabel("Dvd Amount ;"));
                productPanel.add(amount);

                productPanel.add(new JLabel("Dvd Price: "));
                productPanel.add(price);


                productPanel.add(new JLabel("Dvd Genre : "));
                productPanel.add(genre);

                productPanel.add(new JLabel("Value of Inventory:"));
        productPanel.add(valueOfEntireInventory);

                JPanel inventoryPanel = new JPanel (new BorderLayout(5,5));
                inventoryPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

                inventoryPanel.add(productPanel, BorderLayout.CENTER);

                JPanel navigationPanel= new JPanel(new GridLayout (0,4,5,5));
                navigationPanel.add(next);
                navigationPanel.add(previous);
                inventoryPanel.add(navigationPanel, BorderLayout.SOUTH);

                setContentPane(inventoryPanel);

                //itemNumber.setText(String.valueOf(item.getdvdNumber()));
                //name.setText(item.getdvdName());
                //amount.setText(String.valueOf(item.getdvdAmount()));
                //price.setText(String.format("$ .2f", item.getdvdPrice));
                //genre.setText(String.format("\n", item.genre));
                //valueOfEntireInventory.setText(String.format ("\n", item.getValue));





        }



            protected void showFirst(){
                currentIndex=0;
                updateGUI();

            }

    private void creatGUI() {
        throw new UnsupportedOperationException("Not supported yet."); 
    }

    private void updateGUI() {
        throw new UnsupportedOperationException("Not supported yet."); 
    }






    }

Not asking for much, are you? You want us to analyze 430+ lines of code. Reduce it to the sections that you are having problems with. FWIW, I charge my clients $200USD per hour to analyze their code, and this will take at least a couple of hours to do properly.

Sorry did not mean to come off that way. I usually see people posting very little and everyone says, what you want us to do it all for you? I already have most of it done. The only real questions would be trying to get the array to display in the GUI.I am extremely new to Java and this assignment is driving me crazy. The main question I have I guess is where I made it comments in lines 99-100. For some reason I can not pull the arrray with the item.get method. I feel like I have almost all of it finished but then again maybe I am way off.

Cripop: posting little is usually good, if it contains all the relevant code/information.

In your classes, you don't follow naming conventions, you have a number of (static) methods in your classes that I can't imagine what you would need them for ...

If you need to show all the elements of the array at the same time, either show a series of JTextFields underneath each other, or use a JTable, each row representing an element.

Hi Cripop
It's good that you have already done so much, and posted yur progress so far. What's missing is a clear and concise statement of exactly what help you need. You can't expect people to read the spec, read yur code, and figure out which bit(s) you haven't done yet.

Anyway
Where you have
itemNumber.setText(String.valueOf(item.getdvdNumber()));
etc, you need to replace item by a reference to the current member of the array of DVD objects. For that you'll need a variable to hold the index of the current member Previous and next then are just decrementing or incrementing that index and updating the display.

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.