tiad123 0 Newbie Poster

So, yes, this is a homework assignment, but I have been working on it for days and I really need a push in the right direction please. I have a gui with four buttons: first, previous, next and last. The gui comes up fine. I also have 4 windows with the information from my file in them. What I need to do is connect those 4 windows to the buttons so that when I press first it displays the first window, when I hit next it displays the next one. I think that maybe I'm supposed to change the file into a string arraylist but that makes absolutely no sense to me... Anyways, here's what I have so far and if anyone could help I would really appreciate it. Thanks in advance.

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class Inventory5 {
	public static void main (String args[]){
		Cigarettes2 cigarettes;
		inv2 Inv = new inv2();
		
		cigarettes = new Style2(1, "Camel", 45, 4.65,"Soft Pack");
		Inv.add(cigarettes);
		cigarettes = new Style2(2, "Marloboro", 98, 4.97,"Hard Pack");
		Inv.add(cigarettes);
		cigarettes = new Style2(3, "Kool", 12, 3.86,"Soft Pack");
		Inv.add(cigarettes);
		cigarettes = new Style2(4, "Doral", 23, 3.14,"Hard Pack");
		Inv.add(cigarettes);
		cigarettes = new Style2(5, "GPC", 14, 3.12,"Soft Pack");
		Inv.add(cigarettes);
	
		
		GUI go = new GUI();
		go.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		go.setSize(300,200);
		go.setVisible(true);
		
		
	}

}
public class Cigarettes2 implements Comparable {
	
	protected int itemNumber;
	protected String brand;
	protected int units;
	protected double price;
	protected String type;
	
	Cigarettes2(int itemNumber, String brand, int units, double price, String type){
		this.itemNumber = itemNumber;
		this.brand = brand;
		this.units = units;
		this.price = price;
		this.type = type;
		
	}
	public int compareTo (Object o){
		return brand.compareTo(((Cigarettes2) o).getbrand());
}
	public double total(){
	return units * price;
	}
	
	public String getbrand(){
		return brand;
	}

	public String toString(){
		return String.format("Item Number = %2d, Brand = %-20s, Units = %3d, Price = $%6.2f Inventory Value = $%,8.21", itemNumber, brand, units, price, total());
	}
	}
import java.util.Arrays;
import java.util.Scanner;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.Dimension;
import java.io.*;
import javax.swing.*;
import java.util.*;

	public class inv2 {
		private Cigarettes2[] cigarettesx;
		private int counter;
		private JButton prev;
		private JButton next;
		private JButton first;
		private JButton last;
		public int index = 0;
		public static final int MAXIMUM_ITEMS = 10;

		inv2(){
			cigarettesx = new Cigarettes2[10];
			counter = 0;
		}
		public void add(Cigarettes2 cigarettes){
			cigarettesx[counter]= cigarettes;
			++counter;
			sort();
		}
		
			public double totalInv(){
				double totalInv = 0;
			for (int i=0; i<counter;i++)
				totalInv = totalInv + cigarettesx[i].total();
				return totalInv;
			}
		
			private void sort(){
				Arrays.sort(cigarettesx, 0, counter);
			}
			
	}
class Style2 extends Cigarettes2{
		
		String type;
		
		Style2(int itemNumber, String brand, int units, double price, String type){
			super(itemNumber, brand, units, price, type);
			this.itemNumber = itemNumber;
			this.brand = brand;
			this.units = units;
			this.price = price;
			this.type = type;
			
		}
		
		public double restockFee(){
			return  total() * .05;
		}
			
		public String toString(){
			return String.format("Item Number: %d, Brand: %s, Units: %d, Price: $%.2f, Type: %s, Your Inventory Value is: $%.2f, Your Restocking Fee: $%.2f\n" , itemNumber, brand, units, price, type, total(), restockFee());
		}
		
		
	}
private class HandlerClass implements ActionListener{
	
	public void actionPerformed(ActionEvent event){
		JOptionPane.showMessageDialog(null, x.next());
		//not finished... tells what to do if First button is pressed...
		
		
		if (first.equals(event.getActionCommand())){
			first.setText();
		}
		else if (prev.equals(event.getActionCommand())){
			index = index--;
		}
		else if (next.equals(event.getActionCommand())){
			index = index++;
		}
		else if (last.equals(event.getActionCommand())){
			index = MAXIMUM_ITEMS;
		}
	}

	}
}