Changing the Color of My JPanel

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

38 Replies - 1119 Views - Last Post: 16 May 2012 - 11:59 AM Rate Topic: -----

#16 SnoBunny85  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 87
  • Joined: 02-March 10

Re: Changing the Color of My JPanel

Posted 07 May 2012 - 07:04 AM

package components;
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
 
public class InventoryDepartment extends JPanel
                      implements ListSelectionListener {
    private JList list;
    private DefaultListModel listModel;
 
    private static final String addString = "Add Item";
    private static final String deleteString = "Delete Item";
    private JButton deleteButton;
    private JTextField itemName;
 
    public InventoryDepartment() {
        super(new BorderLayout());
 
        listModel = new DefaultListModel();
        listModel.addElement("Item 1");
        listModel.addElement("Item 2");
        listModel.addElement("Item 3");
        listModel.addElement("Item 4");
        listModel.addElement("Item 5");
 
        //Create the list and put it in a scroll pane.
        list = new JList(listModel);
        list.setBackground(new Color(240, 250, 240));
    	list.setForeground(new Color(46, 139, 87));
        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        list.setSelectedIndex(0);
        list.addListSelectionListener(this);
        list.setVisibleRowCount(5);
        JScrollPane listScrollPane = new JScrollPane(list);
 
        JButton addButton = new JButton(addString);
        addButton.setBackground(new Color(240, 250, 240));
        addButton.setForeground(new Color(46, 139, 87));
        AddListener addListener = new AddListener(addButton);
        addButton.setActionCommand(addString);
        addButton.addActionListener(addListener);
        addButton.setEnabled(false);
 
        deleteButton = new JButton(deleteString);
        deleteButton.setBackground(new Color(240, 250, 240));
        deleteButton.setForeground(new Color(46, 139, 87));
        deleteButton.setActionCommand(deleteString);
        deleteButton.addActionListener(new DeleteListener());
 
        itemName = new JTextField(10);
        itemName.setBackground(new Color(240, 250, 240));
        itemName.setForeground(new Color(46, 139, 87));
        itemName.addActionListener(addListener);
        itemName.getDocument().addDocumentListener(addListener);
        String name = listModel.getElementAt(
                              list.getSelectedIndex()).toString();
 
        //Create a panel that uses BoxLayout.
        JPanel buttonPane = new JPanel();
        buttonPane.setBackground(new Color(46, 139, 87));
        buttonPane.setLayout(new BoxLayout(buttonPane,
                                           BoxLayout.LINE_AXIS));
        buttonPane.add(deleteButton);
        buttonPane.add(Box.createHorizontalStrut(5));
        buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
        buttonPane.add(Box.createHorizontalStrut(5));
        buttonPane.add(itemName);
        buttonPane.add(addButton);
        buttonPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
 
        add(listScrollPane, BorderLayout.CENTER);
        add(buttonPane, BorderLayout.PAGE_END);
    }
 
    class DeleteListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            int index = list.getSelectedIndex();
            listModel.remove(index);
 
            int size = listModel.getSize();
 
            if (size == 0) { //Nobody's left, disable firing.
                deleteButton.setEnabled(false);
 
            } else { //Select an index.
                if (index == listModel.getSize()) {
                    //removed item in last position
                    index--;
                }
 
                list.setSelectedIndex(index);
                list.ensureIndexIsVisible(index);
            }
        }
    }
 
   //This listener is shared by the text field and the add button.
    class AddListener implements ActionListener, DocumentListener {
        private boolean alreadyEnabled = false;
        private JButton button;
 
        public AddListener(JButton button) {
            this.button = button;
        }
 
        //Required by ActionListener.
        public void actionPerformed(ActionEvent e) {
            String name = itemName.getText();
 
            //User didn't type in a unique name...
            if (name.equals("") || alreadyInList(name)) {
                Toolkit.getDefaultToolkit().beep();
                itemName.requestFocusInWindow();
                itemName.selectAll();
                return;
            }
 
            int index = list.getSelectedIndex(); //get selected index
            if (index == -1) { //no selection, so insert at beginning
                index = 0;
            } else {           //add after the selected item
                index++;
            }
 
            listModel.insertElementAt(itemName.getText(), index);
             
            //Reset the text field.
            itemName.requestFocusInWindow();
            itemName.setText("");
 
            //Select the new item and make it visible.
            list.setSelectedIndex(index);
            list.ensureIndexIsVisible(index);
        }
 
        //This method tests for string equality. 
        protected boolean alreadyInList(String name) {
            return listModel.contains(name);
        }
 
        //Required by DocumentListener.
        public void insertUpdate(DocumentEvent e) {
            enableButton();
        }
 
        //Required by DocumentListener.
        public void removeUpdate(DocumentEvent e) {
            handleEmptyTextField(e);
        }
 
        //Required by DocumentListener.
        public void changedUpdate(DocumentEvent e) {
            if (!handleEmptyTextField(e)) {
                enableButton();
            }
        }
 
        private void enableButton() {
            if (!alreadyEnabled) {
                button.setEnabled(true);
            }
        }
 
        private boolean handleEmptyTextField(DocumentEvent e) {
            if (e.getDocument().getLength() <= 0) {
                button.setEnabled(false);
                alreadyEnabled = false;
                return true;
            }
            return false;
        }
    }
 
    //This method is required by ListSelectionListener.
    public void valueChanged(ListSelectionEvent e) {
        if (e.getValueIsAdjusting() == false) {
 
            if (list.getSelectedIndex() == -1) {
            //No selection, disable delete button.
                deleteButton.setEnabled(false);
 
            } else {
            //Selection, enable the delete button.
                deleteButton.setEnabled(true);
            }
        }
    }
 
    
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("ListDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
        //Create and set up the content pane.
        JComponent newContentPane = new InventoryDepartment();
        newContentPane.setOpaque(true); //content panes must be opaque
        frame.setContentPane(newContentPane);
 
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }
 
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}



I went back and changed all my buttons to start with lowercase letters.. is that what you were talking about?? It does make sense that, that would make it easier to read and understand. Above is my code for my InventoryDepartment and I am still getting the message that it can't access this file... not sure why not, I did put them all in the same folder...

This post has been edited by SnoBunny85: 07 May 2012 - 07:14 AM

Was This Post Helpful? 0
  • +
  • -

#17 SnoBunny85  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 87
  • Joined: 02-March 10

Re: Changing the Color of My JPanel

Posted 07 May 2012 - 11:23 AM

I figured out why it wouldn't work and have it working perfectly... but now I have another question.
I am setting up my lists so that there are two separate lists sitting right next to each other.. one lists the name of the item and the other the amount of the item.. i want to make it so that when i selected the name of the item that the corresponding amount of item highlights as well.. any suggestions?

/**
 * @(#)InventoryDepartment.java
 *
 *
 * @author 
 * @version 1.00 2012/5/7
 */
 
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class InventoryDepartment extends JPanel{
	private JList list, amount;
	DefaultListModel listModel;
	DefaultListModel amountModel;
	private static final String addString = "Add Item";
	private static final String deleteString = "Delete Item";
	private JButton addButton, deleteButton;
	private JTextField itemName, itemAmount;
	
public InventoryDepartment()
{
		//main panel for the inventory department   				
    				JPanel inventoryDepartment = new JPanel();
    				inventoryDepartment.setLayout(new BorderLayout());
    				inventoryDepartment.setBackground(new Color(46, 139, 87));
    				inventoryDepartment.setPreferredSize(new Dimension(600,600));
    				add(inventoryDepartment);
    				
    		
    				
    				//title of page
    				JLabel title = new JLabel("Inventory Department", SwingConstants.CENTER);
    				title.setVerticalAlignment(SwingConstants.TOP);
    				title.setForeground(new Color(240, 250, 240));
    				Font titleFont = new Font("Bradley Hand ITC", Font.PLAIN, 50);
    				title.setPreferredSize(new Dimension(150,150));
    				title.setFont(titleFont);
    				inventoryDepartment.add(title, BorderLayout.NORTH);
    				
    				//adding names to the columns of information
    				JLabel nameOfItem = new JLabel("Name of Item");
    				nameOfItem.setForeground(new Color(240, 250, 240));
    				Font titleFont2 = new Font("Bradley Hand ITC", Font.PLAIN, 30);
    				nameOfItem.setPreferredSize(new Dimension(150,150));
    				nameOfItem.setFont(titleFont2);
    			    				
    				//creating the inventory list
    				//creating items of what needs to be placed in list
    				
    				listModel = new DefaultListModel();
    				listModel.addElement("item 1");
    				listModel.addElement("item 2");
    				listModel.addElement("item 3");
    				listModel.addElement("item 4");
    				listModel.addElement("item 5");
    				listModel.addElement("item 6");
    				listModel.addElement("item 7");
    				listModel.addElement("item 8");
    				listModel.addElement("item 9");
    				listModel.addElement("item 10");
    				listModel.addElement("item 11");
    				listModel.addElement("item 12");
    				listModel.addElement("item 13");
    				listModel.addElement("item 14");
    				listModel.addElement("item 15");
    				listModel.addElement("item 16");
    				listModel.addElement("item 17");
    				listModel.addElement("item 18");
    				listModel.addElement("item 19");
    				listModel.addElement("item 20");
    				
    				
    				amountModel = new DefaultListModel();
    				amountModel.addElement("amount 1");
    				amountModel.addElement("amount 2");
    				amountModel.addElement("amount 3");
    				amountModel.addElement("amount 4");
    				amountModel.addElement("amount 5");
    				amountModel.addElement("amount 6");
    				amountModel.addElement("amount 7");
    				amountModel.addElement("amount 8");
    				amountModel.addElement("amount 9");
    				amountModel.addElement("amount 10");
    				amountModel.addElement("amount 11");
    				amountModel.addElement("amount 12");
    				amountModel.addElement("amount 13");
    				amountModel.addElement("amount 14");
    				amountModel.addElement("amount 15");
    				amountModel.addElement("amount 16");
    				amountModel.addElement("amount 17");
    				amountModel.addElement("amount 18");
    				amountModel.addElement("amount 19");
    				amountModel.addElement("amount 20");
    				


    				//creating the list itself
    				
    				list = new JList(listModel);
    				list.setBackground(new Color(240, 250, 240));
    				list.setForeground(new Color(46, 139, 87));
    				list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    				list.setSelectedIndex(0);
    				list.setVisibleRowCount(20);
    				JScrollPane listScrollPane = new JScrollPane(list);
    				
    				
    				amount = new JList(amountModel);
    				amount.setBackground(new Color(240, 250, 240));
    				amount.setForeground(new Color(46, 139, 87));
    				amount.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    				amount.setSelectedIndex(0);
    				amount.setVisibleRowCount(20);
    				JScrollPane amountScrollPane = new JScrollPane(amount);
    				
    				//adding item button
    				addButton = new JButton(addString);
    			       			    	
    			    //deleting item button   			    				
    				 deleteButton = new JButton(deleteString);
    			    
    			    
    			    //text field for entering name of item to add to list				
    				itemName = new JTextField(10);
    				String name = listModel.getElementAt(list.getSelectedIndex()).toString();
    				itemAmount = new JTextField(4);
    				String amountName = amountModel.getElementAt(amount.getSelectedIndex()).toString();
    				
    				
    				//panel to hold add and delete button
    				JPanel inventory2 = new JPanel();
    				inventory2.setBackground(new Color(240, 250, 240));
    				
    				//panel to hold inventory list
    				JPanel inventory3 = new JPanel();
    				inventory3.setBackground(new Color(46,139,87));
    				
    				
    				//panels added to correct the look of the system
    				JPanel center = new JPanel(new BorderLayout());
    				center.setBackground(new Color(46, 139, 87));
    				center.add(new JLabel("\n"), BorderLayout.NORTH);
    				center.add(new JLabel("\n"), BorderLayout.SOUTH);
    				center.add(new JLabel("                     "), BorderLayout.WEST);
    				center.add(new JLabel("                     "), BorderLayout.EAST);
    				center.add(inventory3, BorderLayout.CENTER);
    				inventoryDepartment.add(center);
    				
    				//adding items to the panels created previously
    				inventory2.setLayout(new BoxLayout(inventory2, BoxLayout.LINE_AXIS));
    				inventory3.setLayout(new BoxLayout(inventory3, BoxLayout.X_AXIS));
    				inventory2.add(deleteButton);
    				inventory2.add(Box.createHorizontalStrut(5));
    				inventory2.add(new JSeparator(SwingConstants.VERTICAL));
    				inventory2.add(Box.createHorizontalStrut(5));
    				inventory2.add(itemName);
    				inventory2.add(addButton);
    				inventory2.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    				inventory3.add(nameOfItem, BorderLayout.NORTH);
    				inventory3.add(listScrollPane);
    				inventory3.add(amountScrollPane);
    				inventoryDepartment.add(inventory2, BorderLayout.PAGE_END);
    				
    				addButton.addActionListener(new ButtonListener());
					deleteButton.addActionListener(new ButtonListener());
    				
	}
		public class ButtonListener implements ActionListener
    		{
    			public void actionPerformed(ActionEvent event)
    			{	
    				if(event.getSource() == addButton)
    				{
    					
    				}
    				
    				if(event.getSource() == deleteButton)
    				{
    					int index = list.getSelectedIndex();
    					int index2 = 0;
    					index2 = index;
    					    					
    					listModel.remove(index);
    					amountModel.remove(index2);
    					
    					int size = listModel.getSize();
    					if(size == 0)
    					{
    						deleteButton.setEnabled(false);
    					}
    					else
    					{
    						if(index == listModel.getSize())
    						{
    							index--;
    						}
    						
    						list.setSelectedIndex(index);
    						list.ensureIndexIsVisible(index);
    					}
    				}
    			}
    		}	
    				
    
}


Was This Post Helpful? 0
  • +
  • -

#18 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8014
  • View blog
  • Posts: 31,118
  • Joined: 06-March 08

Re: Changing the Color of My JPanel

Posted 07 May 2012 - 11:35 AM

Add a ListSelectionListener to your first JList #1
When and item is selected getSelectedIndex() on that JList
and setSelectedIndex() with that index on JList #2
Was This Post Helpful? 1
  • +
  • -

#19 SnoBunny85  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 87
  • Joined: 02-March 10

Re: Changing the Color of My JPanel

Posted 08 May 2012 - 05:17 AM

If I wanted to get my panel to close how I would do that.. I tried using dispose() and using setVisible(false) but not sure how to call that to the frame because I open the frame in a completely separate class...i also just tried reopening the class I want to get back to but it leaves a lot of windows open in the end... any suggestions?

/**
 * @(#)Commission.java
 *
 *
 * @author 
 * @version 1.00 2012/5/8
 */

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

public class Commission extends JPanel {
	JButton close;
	
   public Commission()
   {
   	
    	JPanel construction = new JPanel();
    	construction.setBackground(new Color(46, 139, 87));
    	construction.setPreferredSize(new Dimension(300,300));
    	add(construction);
    	
    	JLabel title = new JLabel("Under Construction");
    	title.setForeground(new Color(240, 250, 240));
    	Font font = new Font("Bradley Hand ITC", Font.PLAIN, 30);
    	title.setFont(font);
    	construction.add(title);
    	
    	close = new JButton("Close");
    	close.addActionListener(new ButtonListener());
    	close.setForeground(new Color(46, 139, 87));
    	close.setBackground(new Color(240, 250, 240));
    	construction.add(close, BorderLayout.SOUTH);
    	
   }
    public class ButtonListener implements ActionListener
    {
    	public void actionPerformed(ActionEvent e)
    	{
    		if(e.getSource() == close)
    		{
    			JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
    				
    		}
    	}
    }
}


Was This Post Helpful? 0
  • +
  • -

#20 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8014
  • View blog
  • Posts: 31,118
  • Joined: 06-March 08

Re: Changing the Color of My JPanel

Posted 08 May 2012 - 05:35 AM

Just pass your Frame to the constructor of Commission
Save it as an instance variable so your actionPerformed() will be able to access it
Was This Post Helpful? 1
  • +
  • -

#21 SnoBunny85  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 87
  • Joined: 02-March 10

Re: Changing the Color of My JPanel

Posted 08 May 2012 - 06:14 AM

I am sure that is basic knowledge that i should know but I don't know how to pass it... I know what you mean by making it an instance variable so it can be accessed...
Was This Post Helpful? 0
  • +
  • -

#22 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8014
  • View blog
  • Posts: 31,118
  • Joined: 06-March 08

Re: Changing the Color of My JPanel

Posted 08 May 2012 - 06:25 AM

class MyFrame extends JFrame {

    MyFrame() {
       super("This is my application");
       add(new Commission(this));
       ...

class Commission extends JPanel {

    JFrame father;

    Commission(JFrame father) {
       this.father = father;
       ...

    public void actionPerformed(ActionEvent e) {
       father.dispose();


Was This Post Helpful? 1
  • +
  • -

#23 SnoBunny85  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 87
  • Joined: 02-March 10

Re: Changing the Color of My JPanel

Posted 08 May 2012 - 12:09 PM

I am getting an cannot find symbol error at:
public class Details extends JPanel implements ListSelectionListener {



and a cannot find symbol class ListSelectionEvent:
public void valueChanged(ListSelectionEvent e)



Here is my full code:

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

public class Details extends JPanel implements ListSelectionListener {
    
  	private JList nameList, serialList, amountList;
  	DefaultListModel nameModel, serialModel, amountModel;
  	private static final String addString = "Add Item";
  	private static final String deleteString = "Delete Item";
  	private static final String searchString = "Search";
  	private JButton add, delete, search;
  	private JTextField itemName, itemSerial, itemAmount;
  	private JButton accounting, inventoryDepartment, exitSystem, invoices;
  	
  	
    public Details() {
    	
    	//main panel
    	JPanel main = new JPanel();
    	main.setBackground(new Color(46, 139, 87));
    	main.setPreferredSize(new Dimension(800,800));
    	add(main);
    	
    	JPanel details = new JPanel();
    	details.setLayout(new BorderLayout());
   		details.setBackground(new Color(46, 139, 87));
    	details.setPreferredSize(new Dimension(600,600));
    	main.add(details);
    	
    	//label to list names of columns
    	JLabel nameOfItem = new JLabel("              Category of Item:     Serial Number:   Amount of Item:  ");
    	nameOfItem.setForeground(new Color(240, 250, 240));
    	Font title = new Font("Bradley Hand ITC", Font.PLAIN, 20);
    	nameOfItem.setPreferredSize(new Dimension(100,100));
    	nameOfItem.setFont(title);
    	
    	//creating the list of inventory
    	nameModel = new DefaultListModel();
    	serialModel = new DefaultListModel();
    	amountModel = new DefaultListModel();
    	
    	nameModel.addElement("Crew T(Blue)");
    	nameModel.addElement("Crew T(Red)");
    	nameModel.addElement("Crew T(Orange)");
    	nameModel.addElement("Crew T(Black)");
    	nameModel.addElement("Crew T(Green)");
    	
    	serialModel.addElement("34-43-675");
    	serialModel.addElement("34-43-500");
    	serialModel.addElement("34-43-536");
    	serialModel.addElement("34-43-456");
    	serialModel.addElement("34-43-765");
    	
    	amountModel.addElement("12.98");
    	amountModel.addElement("12.98");
    	amountModel.addElement("12.98");
    	amountModel.addElement("12.98");
    	amountModel.addElement("12.98");
    	
    	//creating panels that hold list
    	nameList = new JList(nameModel);
    	nameList.setBackground(new Color(240,250,240));
    	nameList.setForeground(new Color(46,139,87));
    	nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	nameList.setSelectedIndex(0);
    	nameList.setVisibleRowCount(5);
//    	nameList.addListSelectionListener(this);
    	JScrollPane nameListScroll = new JScrollPane(nameList);
    	
    	serialList = new JList(serialModel);
    	serialList.setBackground(new Color(240,250,240));
    	serialList.setForeground(new Color(46,139,87));
    	serialList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	serialList.setSelectedIndex(0);
    	serialList.setVisibleRowCount(5);
//    	serialList.addListSelectionListener(this);
    	JScrollPane serialListScroll = new JScrollPane(serialList);
    	
    	amountList = new JList(amountModel); 
    	amountList.setBackground(new Color(240,250,240));
    	amountList.setForeground(new Color(46,139,87));
    	amountList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	amountList.setSelectedIndex(0);
    	amountList.setVisibleRowCount(5);
//    	amountList.addListSelectionListener(this);
    	JScrollPane amountListScroll = new JScrollPane(amountList);
    	    
    	//adding item buttons
    	add = new JButton(addString);
    	delete = new JButton(deleteString);
    	search = new JButton(searchString);
    	accounting = new JButton("Accounting Department");
    	inventoryDepartment = new JButton("Inventory Department");
    	invoices = new JButton("Invoices");
    	exitSystem = new JButton("Exit System");
    	
    	//text boxes for adding items
    	itemName = new JTextField(10);
    	String name = nameModel.getElementAt(nameList.getSelectedIndex()).toString();
    	itemSerial = new JTextField(10);
    	String serial = serialModel.getElementAt(serialList.getSelectedIndex()).toString();
    	itemAmount = new JTextField(8);
    	String amount = amountModel.getElementAt(amountList.getSelectedIndex()).toString();
    	
    	//panels for holding buttons and scroll panes
    	JPanel panel1 = new JPanel();
    	panel1.setBackground(new Color(46, 139, 87));
    	JPanel panel2 = new JPanel();
    	panel2.setBackground(new Color(46, 139, 87));
    	JPanel panel3 = new JPanel();
   		panel3.setBackground(new Color(46, 139, 87));
    	
    	JPanel center = new JPanel(new BorderLayout());
    	center.setBackground(new Color(46, 139, 87));
    	center.add(new JLabel("\n"), BorderLayout.SOUTH);
    	center.add(new JLabel("                     "), BorderLayout.WEST);
    	center.add(new JLabel("                     "), BorderLayout.EAST);
    	details.add(center);
    	panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    	panel2.add(nameListScroll, BorderLayout.CENTER);
    	panel2.add(serialListScroll, BorderLayout.NORTH);
    	panel2.add(amountListScroll, BorderLayout.NORTH);
    	center.add(nameOfItem, BorderLayout.NORTH);
    	center.add(panel2, BorderLayout.CENTER);
    	
    	//panel for holding navigation buttons
    	panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
		panel3.setBackground(new Color(46, 139, 87));
		panel3.add(new JLabel("             "), BorderLayout.WEST);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(inventoryDepartment, BorderLayout.NORTH);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(accounting, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(invoices, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(exitSystem, BorderLayout.SOUTH);
		panel3.add(new JLabel("                     "), BorderLayout.EAST);
		details.add(panel3, BorderLayout.NORTH);
	    	
    	//adding items to panels
    	panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    	panel1.add(search);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(itemName);
    	panel1.add(itemSerial);
    	panel1.add(itemAmount);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(add);
    	panel1.add(delete);
    	panel1.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    	details.add(panel1, BorderLayout.PAGE_END);
    	
    	//listeners for buttons
    	add.addActionListener(new ButtonListener());
    	delete.addActionListener(new ButtonListener());
    	search.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accounting.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    	exitSystem.addActionListener(new ButtonListener());
    		   
    }
		
		public void valueChanged(ListSelectionEvent e)
		{
			int x = nameList.getSelectedIndex();
			amountList.setSelectedIndex(x);
			serialList.setSelectedIndex(x);
		}
		
		public class ButtonListener implements ActionListener
		{
			public void actionPerformed(ActionEvent event){
				if(event.getSource() == add)
				{
					
				}
				if(event.getSource() == delete)
				{
				}
				if(event.getSource() == search)
				{
				}
				if(event.getSource() == accounting)
				{
				}
				if(event.getSource() == invoices)
				{
				}
				if(event.getSource() == exitSystem)
				{
				}
			}
		}

        
    
}


Was This Post Helpful? 0
  • +
  • -

#24 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8014
  • View blog
  • Posts: 31,118
  • Joined: 06-March 08

Re: Changing the Color of My JPanel

Posted 08 May 2012 - 12:51 PM

import javax.swing.event.*;

I can't beleive, you post questions. I answer to them (a few of them in this post). You come back with another question. Without a word saying if the previous solution worked.

This post is useless for others reading it. They will not know if the proposed solutions worked.
You never replied to say "Ok it works" or may be even "Thanks"

This post has been edited by pbl: 08 May 2012 - 01:03 PM

Was This Post Helpful? 1
  • +
  • -

#25 SnoBunny85  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 87
  • Joined: 02-March 10

Re: Changing the Color of My JPanel

Posted 09 May 2012 - 12:03 PM

Oh, I am so sorry. I am very appreciative of all the help. Everything you have posted has worked or I would have asked more questions about it. I apologize that I haven't responded to all the other posts. It does mean a lot that you are helping me and I keep posting questions because you are of such great help. Ill post all my coding if you want to see it.... just let me know. Again, I am so sorry. I feel bad now.
Was This Post Helpful? 0
  • +
  • -

#26 SnoBunny85  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 87
  • Joined: 02-March 10

Re: Changing the Color of My JPanel

Posted 09 May 2012 - 12:37 PM

Here is my program so far, thanks again for all the help. Means a lot that I can go somewhere and get quick, helpful answers:

Program starter:
/**
 * Project: Warehouse Inventory System
 * Name: Cheryl Minor
 * Date: May 2, 2012
 *
 * Rewriting the Warehouse Inventory System that I created in Visual Basic
 */
 
import javax.swing.*;


public class WarehouseInventorySystem {
        
   
       public static void main(String[] args) {
        //Displaying the main page GUI
        JFrame frame = new JFrame ("Main Page");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new MainFramePanel());
		frame.pack();
		frame.setVisible(true);
    }
    
    
}



Main Page:
/**
 * Name:MainFramePanel.java
 * Function: Main page of inventory system. It holds the buttons that access all the other areas of the
 *  program including inventory department, invoices, accounting department and a way to exit the system.
 */
 
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;


public class MainFramePanel extends JPanel {
	
	//buttons that will be needed
	JButton exitSystem, inventoryDepartment, accountingDepartment, invoices;
	//title of system
	JLabel title;
	

    public MainFramePanel() {
    	
       	//create panel to hold four main buttons
    	JPanel buttonHolder = new JPanel();
    	buttonHolder.setLayout (new BoxLayout (buttonHolder, BoxLayout.Y_AXIS));
    	buttonHolder.setForeground(new Color(240, 250, 240));
    	buttonHolder.setBackground(new Color(46, 139, 87));
    	buttonHolder.setPreferredSize(new Dimension(300,300));
    	add(buttonHolder, BorderLayout.SOUTH);
    	
    	//create a panel to hold the title
    	setLayout(new BorderLayout());
    	JPanel titleHolder = new JPanel();
    	titleHolder.setBackground(new Color(46, 139, 87));
    	titleHolder.setForeground(new Color(240, 250, 240));
    	titleHolder.setPreferredSize(new Dimension(900,100));
    	add(titleHolder, BorderLayout.NORTH);
    	
    	//create the title itself
    	title = new JLabel("Warehouse Inventory System");
    	title.setPreferredSize (new Dimension(600,100));
    	Font font = new Font("Bradley Hand ITC", Font.PLAIN, 42);
    	title.setFont(font);
    	titleHolder.add(title);
    	title.setForeground(new Color(240, 250, 240));
    	    	
    	//add buttons to the main page and color them correctly to match main page
    	Font font1 = new Font("Bradley Hand ITC", Font.PLAIN, 30);
    	inventoryDepartment = new JButton("Inventory Department");
    	inventoryDepartment.setForeground(new Color(46, 139, 87));
    	inventoryDepartment.setBackground(new Color(240, 250, 240));
    	inventoryDepartment.setAlignmentX(Component.CENTER_ALIGNMENT);
    	inventoryDepartment.setFont(font1);  
    	inventoryDepartment.setMaximumSize(new Dimension(400, 100));

    	accountingDepartment = new JButton("Accounting Department");
    	accountingDepartment.setForeground(new Color(46, 139, 87));
    	accountingDepartment.setBackground(new Color(240, 250, 240));
		accountingDepartment.setAlignmentX(Component.CENTER_ALIGNMENT); 
		accountingDepartment.setFont(font1);  
		accountingDepartment.setMaximumSize(new Dimension(400, 100));

    	invoices = new JButton("Invoices");
    	invoices.setForeground(new Color(46, 139, 87));
    	invoices.setBackground(new Color(240, 250, 240));
		invoices.setAlignmentX(Component.CENTER_ALIGNMENT);   
		invoices.setFont(font1);
		invoices.setMaximumSize(new Dimension(400, 100));
		
		exitSystem = new JButton("Exit System");
    	exitSystem.setForeground(new Color(46, 139, 87));
    	exitSystem.setBackground(new Color(240, 250, 240));
		exitSystem.setAlignmentX(Component.CENTER_ALIGNMENT);
		exitSystem.setFont(font1);
		exitSystem.setMaximumSize(new Dimension(400, 100));

    	//add buttons to the display
    	buttonHolder.add(Box.createHorizontalStrut(10));
       	buttonHolder.add(inventoryDepartment);
    	buttonHolder.add(Box.createHorizontalStrut(10));
    	buttonHolder.add(accountingDepartment);
    	buttonHolder.add(Box.createHorizontalStrut(10));
    	buttonHolder.add(invoices);
    	buttonHolder.add(Box.createHorizontalStrut(10));
    	buttonHolder.add(exitSystem);
    	buttonHolder.add(Box.createHorizontalStrut(10));
    	//add display panel to main page
    	add(buttonHolder, BorderLayout.CENTER);
    	
    	//add listeners
    	exitSystem.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accountingDepartment.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    }
    	
    	public class ButtonListener implements ActionListener
    	{
    		public void actionPerformed(ActionEvent event)
    		{
    			//exiting the system
    			if(event.getSource() == exitSystem)
    			    System.exit(0);
    			
    			
    			
    			if(event.getSource() == inventoryDepartment)
    			{
    				//creating the new frame for the inventory department page
    				JFrame frame2 = new JFrame("Inventory Department");
    				frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame2.getContentPane().add(new InventoryDepartment());
    				frame2.pack();
    				frame2.setVisible(true);
    				frame2.setBackground(new Color(46, 139, 87));
    				
    			}
    				
    			if(event.getSource() == accountingDepartment)
    			{
    				//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
    				
    			}
    				
    			if(event.getSource() == invoices)
    			{
    				//creating the new frame for the invoices
    				JFrame frame5 = new JFrame("Invoices");
    				frame5.setBackground(new Color(46,139, 87)); 
    				frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame5.getContentPane().add(new InvoicesAvailable());
    				frame5.setVisible(true);
    				frame5.setSize(600,590);    			
    			}
    		}
    	
    	
    	
    	}//end of buttonlisten implementing actions
    	
   
   
 
}//end of file



Inventory Department:
/**
 * Name: InventoryDepartment.java
 * Function: Holds the main category list of inventory. This includes an add button, delete button and search area. 
 *   It also includes access buttons to accounting, details page as well as exiting the system. 
 */
 
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;


public class InventoryDepartment extends JPanel implements ListSelectionListener{
	private JList list, amount;
	DefaultListModel listModel;
	DefaultListModel amountModel;
	private static final String addString = "Add Item";
	private static final String deleteString = "Delete Item";
	private static final String searchString = "Search";
	private JButton addButton, deleteButton, searchButton;
	private JTextField itemName, itemAmount;
	private JButton accounting, exit, details;
	
public InventoryDepartment()
{
		//main panel for the inventory department   
					
					JPanel inventoryDepartment = new JPanel(new BorderLayout());
    				inventoryDepartment.setBackground(new Color(46, 139, 87));
    				inventoryDepartment.setPreferredSize(new Dimension(600,400));
    				add(inventoryDepartment);
    				
    				//title of page
    				JLabel title = new JLabel("Inventory Department", SwingConstants.CENTER);
    				title.setLayout(new BorderLayout());
    				title.setForeground(new Color(240, 250, 240));
    				Font titleFont = new Font("Bradley Hand ITC", Font.PLAIN, 50);
    				title.setPreferredSize(new Dimension(100,100));
    				title.setFont(titleFont);
    				inventoryDepartment.add(title, BorderLayout.NORTH);
   				   	
    				//adding names to the columns of information
    				JLabel nameOfItem = new JLabel("         Category of Item:          Amount of Item:");
    				nameOfItem.setForeground(new Color(240, 250, 240));
    				Font titleFont2 = new Font("Bradley Hand ITC", Font.PLAIN, 30);
    				nameOfItem.setPreferredSize(new Dimension(100,100));
    				nameOfItem.setFont(titleFont2);
    				
    				
    				//creating the inventory list
    				//creating items of what needs to be placed in list
    				
    				listModel = new DefaultListModel();
    				listModel.addElement("Women's Shirts: Crew");
    				listModel.addElement("Women's Shirts: V-Neck");
    				listModel.addElement("Women's Socks: Low Socks");
    				listModel.addElement("Women's Socks: High Socks");
    				listModel.addElement("Men's Shirts: Crew");
    				listModel.addElement("Men's Shirts: V-Neck");
    				listModel.addElement("Men's Socks: Low Socks");
    				listModel.addElement("Men's Socks: High Socks");
    				
    				
    				
    				amountModel = new DefaultListModel();
    				amountModel.addElement("5");
    				amountModel.addElement("5");
    				amountModel.addElement("5");
    				amountModel.addElement("5");
    				amountModel.addElement("5");
    				amountModel.addElement("5");
    				amountModel.addElement("5");
    				amountModel.addElement("5");
    			
    				
    				//creating the list itself
    				
    				list = new JList(listModel);
    				list.setBackground(new Color(240, 250, 240));
    				list.setForeground(new Color(46, 139, 87));
    				list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    				list.setSelectedIndex(0);
    				list.setVisibleRowCount(20);
    				list.addListSelectionListener(this);
    				JScrollPane listScrollPane = new JScrollPane(list);
    				
    				
    				amount = new JList(amountModel);
    				amount.setBackground(new Color(240, 250, 240));
    				amount.setForeground(new Color(46, 139, 87));
    				amount.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    				amount.setSelectedIndex(0);
    				amount.setVisibleRowCount(8);
    				JScrollPane amountScrollPane = new JScrollPane(amount);
    				
    				//adding item button
    				addButton = new JButton(addString);
    			       			    	
    			    //deleting item button   			    				
    				 deleteButton = new JButton(deleteString);
    			    
    			    //searching for an item button
    			    searchButton = new JButton(searchString);
    			    
    			    //text field for entering name of item to add to list				
    				itemName = new JTextField(10);
    				String name = listModel.getElementAt(list.getSelectedIndex()).toString();
    				itemAmount = new JTextField(4);
    				String amountName = amountModel.getElementAt(amount.getSelectedIndex()).toString();
    				
    				
    				//panel to hold add and delete button
    				JPanel inventory2 = new JPanel();
    				inventory2.setBackground(new Color(240, 250, 240));
    				
    				//panel to hold inventory list
    				JPanel inventory3 = new JPanel();
    				inventory3.setBackground(new Color(46,139,87));
    				
    				
    				
    				//panels added to correct the look of the system
    				JPanel center = new JPanel(new BorderLayout());
    				center.setBackground(new Color(46, 139, 87));
    				center.add(new JLabel("\n"), BorderLayout.SOUTH);
    				center.add(new JLabel("                     "), BorderLayout.WEST);
    				center.add(new JLabel("                     "), BorderLayout.EAST);
    				inventoryDepartment.add(center);
    				inventory3.setLayout(new BoxLayout(inventory3, BoxLayout.X_AXIS));
    				inventory3.add(listScrollPane, BorderLayout.NORTH);
    				inventory3.add(amountScrollPane, BorderLayout.NORTH);
    				center.add(nameOfItem, BorderLayout.NORTH);
    				center.add(inventory3, BorderLayout.CENTER);
    				
    				//adding items to the 
    				//panels created previously
    				inventory2.setLayout(new BoxLayout(inventory2, BoxLayout.LINE_AXIS));
    				inventory2.add(searchButton);
    				inventory2.add(Box.createHorizontalStrut(5));
    				inventory2.add(new JSeparator(SwingConstants.VERTICAL));
    				inventory2.add(Box.createHorizontalStrut(5));
    				inventory2.add(itemName);
    				inventory2.add(itemAmount);
    				inventory2.add(addButton);
    				inventory2.add(deleteButton);
    				inventory2.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    				inventoryDepartment.add(inventory2, BorderLayout.PAGE_END);
    				
    				//buttons to navigate through pages
					exit = new JButton("Exit System");
					exit.setForeground(new Color(46, 139, 87));
					exit.setBackground(new Color(240, 250, 240));
					Font font4 = new Font("Arial", Font.PLAIN, 20);
					exit.setFont(font4);
					accounting = new JButton("Accounting Department");
					accounting.setForeground(new Color(46, 139, 87));
					accounting.setBackground(new Color(240, 250, 240));
					accounting.setFont(font4);
					details = new JButton("Details");
					details.setForeground(new Color(46, 139, 87));
					details.setBackground(new Color(240, 250, 240));
					details.setFont(font4);
					

					//panel to hold navigation buttons
					JPanel navigation = new JPanel();
					navigation.setLayout(new BoxLayout(navigation, BoxLayout.X_AXIS));
					navigation.setBackground(new Color(46, 139, 87));
					navigation.add(new JSeparator(SwingConstants.VERTICAL));
					navigation.add(Box.createHorizontalStrut(5));
					navigation.add(details, BorderLayout.NORTH);
					navigation.add(Box.createHorizontalStrut(5));
					navigation.add(accounting, BorderLayout.CENTER);
					navigation.add(Box.createHorizontalStrut(5));
					navigation.add(exit, BorderLayout.SOUTH);
					navigation.add(new JLabel("                     "), BorderLayout.EAST);
					inventoryDepartment.add(navigation, BorderLayout.PAGE_START);
					
					//action listeners for all buttons
					addButton.addActionListener(new ButtonListener());
					deleteButton.addActionListener(new ButtonListener());
					searchButton.addActionListener(new ButtonListener());
					exit.addActionListener(new ButtonListener());
					details.addActionListener(new ButtonListener());
					accounting.addActionListener(new ButtonListener());
					
					
					
	}
	
		public void valueChanged(ListSelectionEvent e)
		{
			int x = list.getSelectedIndex();
			amount.setSelectedIndex(x);
			
		}
		public class ButtonListener implements ActionListener
    		{
    			public void actionPerformed(ActionEvent event)
    			{	
    				//adding an item to the list
    				if(event.getSource() == addButton)
    				{
    					String name = itemName.getText();
    					String amount = itemAmount.getText();
    					
    					if(name.equals(""))
    					{
    						itemName.requestFocusInWindow();
    						itemName.selectAll();
    						return;
    					}
    					
    					int index = list.getSelectedIndex();
    					int index2 = 0;
    					index2 = index;
    					
    					if(index == -1)
    					{
    						index = 0;
    					}	
    					else
    					{
    						index++;
    					}	
    						
    					listModel.addElement(itemName.getText());
    					amountModel.addElement(itemAmount.getText());
    					
    					itemName.requestFocusInWindow();
    					itemName.setText("");
    					itemAmount.setText("");
    					
    					list.setSelectedIndex(index);
    					list.ensureIndexIsVisible(index);
    					
    					
    				}
    				
    				//deleting an item from the list
    				if(event.getSource() == deleteButton)
    				{
    					int index = list.getSelectedIndex();
    					int index2 = 0;
    					index2 = index;
    					    					
    					listModel.remove(index);
    					amountModel.remove(index2);
    					
    					int size = listModel.getSize();
    					if(size == 0)
    					{
    						deleteButton.setEnabled(false);
    					}
    					else
    					{
    						if(index == listModel.getSize())
    						{
    							index--;
    						}
    						
    						list.setSelectedIndex(index);
    						list.ensureIndexIsVisible(index);
    					}
    				}
    				
    				//searching for an item in the list
    				if(event.getSource() == searchButton)
    				{
    					String text = itemName.getText();
    					if(listModel.contains(text))
    					{
    						int index = listModel.indexOf(text);
    						list.setSelectedIndex(index);
    						
    					}
    				}
    				
    				//exiting the system
    				if(event.getSource() == exit)
    				{
    					System.exit(0);
    				}
    				
    				
    				if(event.getSource() == accounting)
    				{
    					//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
    				}
    				
    				//creating a new page for the details of the main categories
    				if(event.getSource() == details)
    				{
    					int x = list.getSelectedIndex();
    					if(x == 0)
    					{
    					
    						JFrame details0 = new JFrame("Details Page");
    						details0.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    						details0.getContentPane().add(new Details());
    						details0.pack();
    						details0.setVisible(true);
    						details0.setBackground(new Color(46, 139, 87));
    						details0.setSize(610,650);
    					}
    					if(x == 1)
    					{
    						JFrame details1 = new JFrame("Details Page");
    						details1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    						details1.getContentPane().add(new DetailsOne());
    						details1.pack();
    						details1.setVisible(true);
    						details1.setSize(610,650);
    					}
    					if(x == 2)
    					{
    						JFrame details2 = new JFrame("Details Page");
    						details2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    						details2.getContentPane().add(new DetailsTwo());
    						details2.pack();
    						details2.setVisible(true);
    						details2.setSize(610,650);
    					
    					}
    					if(x == 3)
    					{
    						JFrame details3 = new JFrame("Details Page");
    						details3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    						details3.getContentPane().add(new DetailsThree());
    						details3.pack();
    						details3.setVisible(true);
    						details3.setSize(610,650);
    						
    					}
    					if(x == 4)
    					{
    						JFrame details4 = new JFrame("Details Page");
    						details4.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    						details4.getContentPane().add(new DetailsFour());
    						details4.pack();
    						details4.setVisible(true);
    						details4.setSize(610,650);
    					}
    					if(x == 5)
    					{
    						JFrame details5 = new JFrame("Details Page");
    						details5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    						details5.getContentPane().add(new DetailsFive());
    						details5.pack();
    						details5.setVisible(true);
    						details5.setSize(610,650);
    						
    					}
    					if(x == 6)
    					{
    						JFrame details6 = new JFrame("Details Page");
    						details6.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    						details6.getContentPane().add(new DetailsSix());
    						details6.pack();
    						details6.setVisible(true);
    						details6.setSize(610,650);
    					}
    					if(x == 7)
    					{
    						JFrame details7 = new JFrame("Details Page");
    						details7.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    						details7.getContentPane().add(new DetailsSeven());
    						details7.pack();
    						details7.setVisible(true);
    						details7.setSize(610,650);
    					}	
    				}
    			}
    		}	
    				
    
}



Accounting Department:
/**
 * Name:AccountingDepartment.java
 * Function: This is the accounting department page. It contains access to the payroll system, commission, inventory department,
 *    invoices, reordering department and allows an exit from the system.
 */

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


public class AccountingDepartment extends JPanel{
	private JButton payroll, commission, exitSystem, inventoryDepartment, invoices, reorderItems;
	public AccountingDepartment(){

    
    			//main panel for the inventory department   				
    				JPanel accountingDepartment = new JPanel();
    				accountingDepartment.setLayout(new BorderLayout());
    				accountingDepartment.setBackground(new Color(46, 139, 87));
    				accountingDepartment.setPreferredSize(new Dimension(600,600));
    				add(accountingDepartment);
    				
    				//title to page
    				JLabel title = new JLabel("Accounting Department", SwingConstants.CENTER);
    				title.setVerticalAlignment(SwingConstants.TOP);
    				Font font3 = new Font("Bradley Hand ITC", Font.PLAIN, 50);
    				title.setFont(font3);
    				title.setForeground(new Color(240, 250, 240));
    				accountingDepartment.add(title);
    				
    				//panel to hold buttons
    				JPanel buttons = new JPanel();
    				buttons.setBackground(new Color(46, 139, 87));
    				buttons.setPreferredSize(new Dimension(400,400));
    				accountingDepartment.add(buttons, BorderLayout.SOUTH);
    				
    				
    				//adding buttons for access to other areas in the accounting department
    				Font fontButton = new Font("Bradley Hand ITC", Font.PLAIN, 30);
    				payroll = new JButton("Payroll Department");
    				payroll.setBackground(new Color(240, 250, 240));
    				payroll.setForeground(new Color(46, 139, 87));
    				payroll.setAlignmentX(Component.CENTER_ALIGNMENT);
    				payroll.setMaximumSize(new Dimension(400, 200));
    				payroll.setFont(fontButton);
    				
    				
    				commission = new JButton("Commission");
    				commission.setBackground(new Color(240, 250, 240));
    				commission.setForeground(new Color(46, 139, 87));
    				commission.setAlignmentX(Component.CENTER_ALIGNMENT);
    				commission.setMaximumSize(new Dimension(400,200));
    				commission.setFont(fontButton);
    				
    				invoices = new JButton("Invoices");
    				invoices.setBackground(new Color(240, 250, 240));
    				invoices.setForeground(new Color(46, 139, 87));
    				invoices.setAlignmentX(Component.CENTER_ALIGNMENT);
    				invoices.setMaximumSize(new Dimension(400,200));
    				invoices.setFont(fontButton);
    				
    				inventoryDepartment = new JButton("Inventory Department");
    				inventoryDepartment.setBackground(new Color(240, 250, 240));
    				inventoryDepartment.setForeground(new Color(46, 139, 87));
    				inventoryDepartment.setAlignmentX(Component.CENTER_ALIGNMENT);
    				inventoryDepartment.setMaximumSize(new Dimension(400,200));
    				inventoryDepartment.setFont(fontButton);
    				
    				reorderItems = new JButton("Reorder Items");
    				reorderItems.setBackground(new Color(240, 250, 240));
    				reorderItems.setForeground(new Color(46, 139, 87));
    				reorderItems.setAlignmentX(Component.CENTER_ALIGNMENT);
    				reorderItems.setMaximumSize(new Dimension(400,200));
    				reorderItems.setFont(fontButton);
    				
    				exitSystem = new JButton("Exit System");
    				exitSystem.setBackground(new Color(240, 250, 240));
    				exitSystem.setForeground(new Color(46, 139, 87));
    				exitSystem.setAlignmentX(Component.CENTER_ALIGNMENT);
    				exitSystem.setMaximumSize(new Dimension(400,200));
    				exitSystem.setFont(fontButton);
    				
    				
					//adding buttons to panel
    				buttons.setLayout (new BoxLayout (buttons, BoxLayout.Y_AXIS));
    				buttons.add(Box.createHorizontalStrut(10));
	  				buttons.add(payroll);
    				buttons.add(Box.createHorizontalStrut(10));
    				buttons.add(commission);
    				buttons.add(Box.createHorizontalStrut(10));
    				buttons.add(invoices);
    				buttons.add(Box.createHorizontalStrut(10));
    				buttons.add(inventoryDepartment);
    				buttons.add(Box.createHorizontalStrut(10));
    				buttons.add(reorderItems);
    				buttons.add(Box.createHorizontalStrut(10));
    				buttons.add(exitSystem);
    		 		buttons.add(Box.createHorizontalStrut(10));
    		 		
    		 		//action listeners for the buttons
    		 		payroll.addActionListener(new ButtonListener());
    		 		commission.addActionListener(new ButtonListener());
    		 		invoices.addActionListener(new ButtonListener());
    		 		inventoryDepartment.addActionListener(new ButtonListener());
    		 		reorderItems.addActionListener(new ButtonListener());
    		 		exitSystem.addActionListener(new ButtonListener());
        
    }


			public class ButtonListener implements ActionListener
			{
				public void actionPerformed(ActionEvent e)
				{
					if(e.getSource() == payroll)
					{
						//creating the new frame for the payroll page
						JFrame commission = new JFrame("Payroll and Commission");
						commission.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
						commission.getContentPane().add(new Payroll());
						commission.pack();
						commission.setVisible(true);
						commission.setSize(300,300);
					}
					
					if(e.getSource() == commission)
					{
						//creating the new frame for the commission page
						JFrame commission = new JFrame("Payroll and Commission");
						commission.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
						commission.getContentPane().add(new Commission());
						commission.pack();
						commission.setVisible(true);
						commission.setSize(300,300);
					}
					
					if(e.getSource() == inventoryDepartment)
					{
						//creating the new frame for the inventory department page
    					JFrame frame2 = new JFrame("Inventory Department");
    					frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    					frame2.getContentPane().add(new InventoryDepartment());
    					frame2.pack();
    					frame2.setVisible(true);
    					frame2.setBackground(new Color(46, 139, 87));
					}
					
					if(e.getSource() == invoices)
					{
						//creating the new frame for the invoices
    					JFrame frame5 = new JFrame("Invoices");
    					frame5.setBackground(new Color(46,139, 87)); 
    					frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    					frame5.getContentPane().add(new InvoicesAvailable());
    					frame5.setVisible(true);
    					frame5.setSize(600,650); 
					}
					if(e.getSource() == exitSystem)
					{
						//exiting the system
						System.exit(0);
					}
					
				}
			}
}



Invoices:
/**
 * Name: InvoicesAvailable.java
 * Function: List the available invoices for the warehouse worker to fill. This page is still under construction. The invoice buttons
 *   do not do anything yet.
 */

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


public class InvoicesAvailable extends JPanel {
    
    public InvoicesAvailable()
    {
    				//Panel to cover frame
    				JPanel main = new JPanel();
    				main.setLayout(new BorderLayout());
    				main.setBackground(new Color(46, 139, 87));
    				main.setPreferredSize(new Dimension(600, 550));
    				add(main);
    				
    				//title
    				JLabel title = new JLabel("Invoices Available", SwingConstants.CENTER);
    				title.setVerticalAlignment(SwingConstants.TOP);
    				Font font3 = new Font("Bradley Hand ITC", Font.PLAIN, 50);
    				title.setFont(font3);
    				title.setForeground(new Color(240, 250, 240));
    				title.setBackground(new Color(46, 139, 87));
    				main.add(title, BorderLayout.NORTH);
    				
    				//main panel for the invoices   				
    				JPanel invoices = new JPanel();
    				invoices.setLayout(new BorderLayout());
    				invoices.setBackground(new Color(46, 139, 87));
    				invoices.setPreferredSize(new Dimension(600,500));
    				main.add(invoices, BorderLayout.SOUTH);
    				
    				//panel for holding invoice buttons
    				Font fontButton = new Font("Bradley Hand ITC", Font.PLAIN, 45);
    				JPanel buttons = new JPanel();
    				buttons.setBackground(new Color(46, 139, 87));
    				buttons.setLayout(new BoxLayout(buttons, BoxLayout.Y_AXIS));
    				buttons.add(Box.createVerticalStrut(10));
    				invoices.add(buttons, BorderLayout.SOUTH);
    				
    				//buttons for invoices
    				JButton invoice1 = new JButton("Invoice");
    				invoice1.setBackground(new Color(240, 250, 240));
    				invoice1.setForeground(new Color(46, 139, 87));
    				invoice1.setAlignmentX(Component.CENTER_ALIGNMENT);
    				invoice1.setFont(fontButton);
    				invoice1.setMaximumSize(new Dimension(300,100));
    				buttons.add(invoice1);
    				buttons.add(Box.createVerticalStrut(10));
    				
    				JButton invoice2 = new JButton("Invoice");
    				invoice2.setBackground(new Color(240, 250, 240));
    				invoice2.setForeground(new Color(46, 139, 87));
    				invoice2.setAlignmentX(Component.CENTER_ALIGNMENT);
    				invoice2.setFont(fontButton);
    				invoice2.setMaximumSize(new Dimension(300,100));
    				buttons.add(invoice2);
    				buttons.add(Box.createVerticalStrut(10));
    				
    				JButton invoice3 = new JButton("Invoice");
    				invoice3.setBackground(new Color(240, 250, 240));
    				invoice3.setForeground(new Color(46, 139, 87));
    				invoice3.setAlignmentX(Component.CENTER_ALIGNMENT);
    				invoice3.setFont(fontButton);
    				invoice3.setMaximumSize(new Dimension(300,200));
    				buttons.add(invoice3);
    				buttons.add(Box.createVerticalStrut(10));
    				
    				
    				JButton invoice4 = new JButton("Invoice");
    				invoice4.setBackground(new Color(240, 250, 240));
    				invoice4.setForeground(new Color(46, 139, 87));
    				invoice4.setAlignmentX(Component.CENTER_ALIGNMENT);
    				invoice4.setFont(fontButton);
    				invoice4.setMaximumSize(new Dimension(300,100));
    				buttons.add(invoice4);
    				buttons.add(Box.createVerticalStrut(10));
    			
    				JButton invoice5 = new JButton("Invoice");
    				invoice5.setBackground(new Color(240, 250, 240));
    				invoice5.setForeground(new Color(46, 139, 87));
    				invoice5.setAlignmentX(Component.CENTER_ALIGNMENT);
    				invoice5.setFont(fontButton);
    				invoice5.setMaximumSize(new Dimension(300,100));
    				buttons.add(invoice5);
    				buttons.add(Box.createVerticalStrut(10));
    			
    				JButton invoice6 = new JButton("Invoice");
    				invoice6.setBackground(new Color(240, 250, 240));
    				invoice6.setForeground(new Color(46, 139, 87));
    				invoice6.setAlignmentX(Component.CENTER_ALIGNMENT);
    				invoice6.setFont(fontButton);
    				invoice6.setMaximumSize(new Dimension(300,100));
    				buttons.add(invoice6);
    				buttons.add(Box.createVerticalStrut(10));
}
}



All the detail pages for the inventory department:
Women's Crew Shirts
/**
 * Name: Details.java
 * Function: This lists the items located in the Women's Crew T-Shirts Category.
 *
 */
 import javax.swing.event.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;

public class Details extends JPanel implements ListSelectionListener {
    
  	private JList nameList, serialList, amountList, priceList;
  	DefaultListModel nameModel, serialModel, amountModel, priceModel;
  	private static final String addString = "Add Item";
  	private static final String deleteString = "Delete Item";
  	private static final String searchString = "Search";
  	private JButton add, delete, search;
  	private JTextField itemName, itemSerial, itemAmount, itemPrice;
  	private JButton accounting, inventoryDepartment, exitSystem, invoices;
  	
  	
    public Details() {
    	
    	//main panel
    	JPanel main = new JPanel();
    	main.setBackground(new Color(46, 139, 87));
    	main.setPreferredSize(new Dimension(800,800));
    	add(main);
    	
    	JPanel details = new JPanel();
    	details.setLayout(new BorderLayout());
   		details.setBackground(new Color(46, 139, 87));
    	details.setPreferredSize(new Dimension(600,600));
    	main.add(details);
    	
    	//label to list names of columns
    	JLabel nameOfItem = new JLabel("      Category of Item:    Serial Number:   Price of Item:  Amount of Item:  ");
    	nameOfItem.setForeground(new Color(240, 250, 240));
    	Font title = new Font("Bradley Hand ITC", Font.PLAIN, 20);
    	nameOfItem.setPreferredSize(new Dimension(100,100));
    	nameOfItem.setFont(title);
    	
    	//creating the list of inventory
    	nameModel = new DefaultListModel();
    	serialModel = new DefaultListModel();
    	priceModel = new DefaultListModel();
    	amountModel = new DefaultListModel();
    	
    	nameModel.addElement("Crew T(Blue)");
    	nameModel.addElement("Crew T(Red)");
    	nameModel.addElement("Crew T(Orange)");
    	nameModel.addElement("Crew T(Black)");
    	nameModel.addElement("Crew T(Green)");
    	
    	serialModel.addElement("34-43-675");
    	serialModel.addElement("34-43-500");
    	serialModel.addElement("34-43-536");
    	serialModel.addElement("34-43-456");
    	serialModel.addElement("34-43-765");
    	
    	
    	priceModel.addElement("12.98");
    	priceModel.addElement("12.98");
    	priceModel.addElement("12.98");
    	priceModel.addElement("12.98");
    	priceModel.addElement("12.98");
    	
    	amountModel.addElement("30");
    	amountModel.addElement("35");
    	amountModel.addElement("26");
    	amountModel.addElement("15");
    	amountModel.addElement("23");

    	
    	//creating panels that hold list
    	nameList = new JList(nameModel);
    	nameList.setBackground(new Color(240,250,240));
    	nameList.setForeground(new Color(46,139,87));
    	nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	nameList.setSelectedIndex(0);
    	nameList.setVisibleRowCount(5);
    	nameList.addListSelectionListener(this);
    	JScrollPane nameListScroll = new JScrollPane(nameList);
    	
    	serialList = new JList(serialModel);
    	serialList.setBackground(new Color(240,250,240));
    	serialList.setForeground(new Color(46,139,87));
    	serialList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	serialList.setSelectedIndex(0);
    	serialList.setVisibleRowCount(5);
    	serialList.addListSelectionListener(this);
    	JScrollPane serialListScroll = new JScrollPane(serialList);
    	
    	
    	priceList = new JList(priceModel);
    	priceList.setBackground(new Color(240,250,240));
    	priceList.setForeground(new Color(46, 139, 87));
    	priceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	priceList.setSelectedIndex(0);
    	priceList.setVisibleRowCount(5);
    	//priceList.addListSelectionListener(this);
    	JScrollPane priceListScroll = new JScrollPane(priceList);
    	
    	amountList = new JList(amountModel); 
    	amountList.setBackground(new Color(240,250,240));
    	amountList.setForeground(new Color(46,139,87));
    	amountList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	amountList.setSelectedIndex(0);
    	amountList.setVisibleRowCount(5);
    	amountList.addListSelectionListener(this);
    	JScrollPane amountListScroll = new JScrollPane(amountList);
    	    
    	//adding item buttons
    	add = new JButton(addString);
    	delete = new JButton(deleteString);
    	search = new JButton(searchString);
    	accounting = new JButton("Accounting Department");
    	inventoryDepartment = new JButton("Inventory Department");
    	invoices = new JButton("Invoices");
    	exitSystem = new JButton("Exit System");
    	
    	//text boxes for adding items
    	itemName = new JTextField(10);
    	String name = nameModel.getElementAt(nameList.getSelectedIndex()).toString();
    	itemSerial = new JTextField(10);
    	String serial = serialModel.getElementAt(serialList.getSelectedIndex()).toString();
    	itemAmount = new JTextField(10);
    	String amount = amountModel.getElementAt(amountList.getSelectedIndex()).toString();
    	itemPrice = new JTextField(10);
    	String price = priceModel.getElementAt(priceList.getSelectedIndex()).toString();
    	
    	//panels for holding buttons and scroll panes
    	JPanel panel1 = new JPanel();
    	panel1.setBackground(new Color(46, 139, 87));
    	JPanel panel2 = new JPanel();
    	panel2.setBackground(new Color(46, 139, 87));
    	JPanel panel3 = new JPanel();
   		panel3.setBackground(new Color(46, 139, 87));
    	
    	JPanel center = new JPanel(new BorderLayout());
    	center.setBackground(new Color(46, 139, 87));
    	center.add(new JLabel("\n"), BorderLayout.SOUTH);
    	center.add(new JLabel("   "), BorderLayout.WEST);
    	center.add(new JLabel("   "), BorderLayout.EAST);
    	details.add(center);
    	panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    	panel2.add(nameListScroll, BorderLayout.CENTER);
    	panel2.add(serialListScroll, BorderLayout.NORTH);
    	panel2.add(priceListScroll, BorderLayout.NORTH);
    	panel2.add(amountListScroll, BorderLayout.NORTH);
    	center.add(nameOfItem, BorderLayout.NORTH);
    	center.add(panel2, BorderLayout.CENTER);
    	
    	//panel for holding navigation buttons
    	panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
		panel3.setBackground(new Color(46, 139, 87));
		panel3.add(new JLabel("             "), BorderLayout.WEST);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(inventoryDepartment, BorderLayout.NORTH);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(accounting, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(invoices, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(exitSystem, BorderLayout.SOUTH);
		panel3.add(new JLabel("                     "), BorderLayout.EAST);
		details.add(panel3, BorderLayout.NORTH);
	    	
    	//adding items to panels
    	panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    	panel1.add(search);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(itemName);
    	panel1.add(itemSerial);
    	panel1.add(itemPrice);
    	panel1.add(itemAmount);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(add);
    	panel1.add(delete);
    	panel1.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    	details.add(panel1, BorderLayout.PAGE_END);
    	
    	//listeners for buttons
    	add.addActionListener(new ButtonListener());
    	delete.addActionListener(new ButtonListener());
    	search.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accounting.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    	exitSystem.addActionListener(new ButtonListener());
    		   
    }
		
		public void valueChanged(ListSelectionEvent e)
		{
			int x = nameList.getSelectedIndex();
			amountList.setSelectedIndex(x);
			priceList.setSelectedIndex(x);
			serialList.setSelectedIndex(x);
		}
		
		
		public class ButtonListener implements ActionListener
		{
			public void actionPerformed(ActionEvent event){
				if(event.getSource() == add)
				{
					String name = itemName.getText();
					String serial = itemSerial.getText();
					String price = itemPrice.getText();
					String amount = itemAmount.getText();
					
					if(name.equals(""))
					{
						itemName.requestFocusInWindow();
						itemName.selectAll();
						return;
					}
					
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					if(index == -1)
					{
						index = 0;
					}
					else
					{
						index++;
					}
					
					nameModel.addElement(itemName.getText());
					serialModel.addElement(itemSerial.getText());
					priceModel.addElement(itemPrice.getText());
					amountModel.addElement(itemAmount.getText());
									
					nameList.setSelectedIndex(index);
					nameList.ensureIndexIsVisible(index);
					
					
				}
				if(event.getSource() == delete)
				{
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					
				}
				if(event.getSource() == search)
				{
					String text = itemName.getText();
    					if(nameModel.contains(text))
    					{
    						int index = nameModel.indexOf(text);
    						nameList.setSelectedIndex(index);
    						amountList.setSelectedIndex(index);
    						priceList.setSelectedIndex(index);
    						serialList.setSelectedIndex(index);
    						
    					}
				}
				if(event.getSource() == accounting)
				{
						//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == inventoryDepartment)
				{
						//creating the new frame for the inventory department page
    				JFrame frame2 = new JFrame("Inventory Department");
    				frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame2.getContentPane().add(new InventoryDepartment());
    				frame2.pack();
    				frame2.setVisible(true);
    				frame2.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == invoices)
				{
					//creating the new frame for the invoices
    				JFrame frame5 = new JFrame("Invoices");
    				frame5.setBackground(new Color(46,139, 87)); 
    				frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame5.getContentPane().add(new InvoicesAvailable());
    				frame5.setVisible(true);
    				frame5.setSize(600,590);   
				}
				if(event.getSource() == exitSystem)
				{
					 System.exit(0);
				}
			}
		}

        
    
}



Women's V-Neck Shirts
/**
 * Name: DetailsOne.java
 * Function: This lists the items located in the Women's V-Neck T-shirts Category.
 *
 */

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


public class DetailsOne extends JPanel implements ListSelectionListener{
    
   private JList nameList, serialList, amountList, priceList;
  	DefaultListModel nameModel, serialModel, amountModel, priceModel;
  	private static final String addString = "Add Item";
  	private static final String deleteString = "Delete Item";
  	private static final String searchString = "Search";
  	private JButton add, delete, search;
  	private JTextField itemName, itemSerial, itemAmount, itemPrice;
  	private JButton accounting, inventoryDepartment, exitSystem, invoices;
  	
  	
    public DetailsOne() {
    	
    	//main panel
    	JPanel main = new JPanel();
    	main.setBackground(new Color(46, 139, 87));
    	main.setPreferredSize(new Dimension(800,800));
    	add(main);
    	
    	JPanel details = new JPanel();
    	details.setLayout(new BorderLayout());
   		details.setBackground(new Color(46, 139, 87));
    	details.setPreferredSize(new Dimension(600,600));
    	main.add(details);
    	
    	//label to list names of columns
    	JLabel nameOfItem = new JLabel("      Category of Item:    Serial Number:   Price of Item:  Amount of Item:  ");
    	nameOfItem.setForeground(new Color(240, 250, 240));
    	Font title = new Font("Bradley Hand ITC", Font.PLAIN, 20);
    	nameOfItem.setPreferredSize(new Dimension(100,100));
    	nameOfItem.setFont(title);
    	
    	//creating the list of inventory
    	nameModel = new DefaultListModel();
    	serialModel = new DefaultListModel();
    	priceModel = new DefaultListModel();
    	amountModel = new DefaultListModel();
    	
    	nameModel.addElement("V-Neck T(Blue)");
    	nameModel.addElement("V-Neck T(Red)");
    	nameModel.addElement("V-Neck T(Orange)");
    	nameModel.addElement("V-Neck T(Black)");
    	nameModel.addElement("V-Neck T(Green)");
    	
    	serialModel.addElement("34-60-453");
    	serialModel.addElement("34-60-500");
    	serialModel.addElement("34-60-536");
    	serialModel.addElement("34-60-456");
    	serialModel.addElement("34-60-765");
    	
    	
    	priceModel.addElement("13.98");
    	priceModel.addElement("13.98");
    	priceModel.addElement("13.98");
    	priceModel.addElement("13.98");
    	priceModel.addElement("13.98");
    	
    	amountModel.addElement("22");
    	amountModel.addElement("29");
    	amountModel.addElement("15");
    	amountModel.addElement("3");
    	amountModel.addElement("16");

    	
    	//creating panels that hold list
    	nameList = new JList(nameModel);
    	nameList.setBackground(new Color(240,250,240));
    	nameList.setForeground(new Color(46,139,87));
    	nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	nameList.setSelectedIndex(0);
    	nameList.setVisibleRowCount(5);
//    	nameList.addListSelectionListener(this);
    	JScrollPane nameListScroll = new JScrollPane(nameList);
    	
    	serialList = new JList(serialModel);
    	serialList.setBackground(new Color(240,250,240));
    	serialList.setForeground(new Color(46,139,87));
    	serialList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	serialList.setSelectedIndex(0);
    	serialList.setVisibleRowCount(5);
//    	serialList.addListSelectionListener(this);
    	JScrollPane serialListScroll = new JScrollPane(serialList);
    	
    	
    	priceList = new JList(priceModel);
    	priceList.setBackground(new Color(240,250,240));
    	priceList.setForeground(new Color(46, 139, 87));
    	priceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	priceList.setSelectedIndex(0);
    	priceList.setVisibleRowCount(5);
    	//priceList.addListSelectionListener(this);
    	JScrollPane priceListScroll = new JScrollPane(priceList);
    	
    	amountList = new JList(amountModel); 
    	amountList.setBackground(new Color(240,250,240));
    	amountList.setForeground(new Color(46,139,87));
    	amountList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	amountList.setSelectedIndex(0);
    	amountList.setVisibleRowCount(5);
//    	amountList.addListSelectionListener(this);
    	JScrollPane amountListScroll = new JScrollPane(amountList);
    	    
    	//adding item buttons
    	add = new JButton(addString);
    	delete = new JButton(deleteString);
    	search = new JButton(searchString);
    	accounting = new JButton("Accounting Department");
    	inventoryDepartment = new JButton("Inventory Department");
    	invoices = new JButton("Invoices");
    	exitSystem = new JButton("Exit System");
    	
    	//text boxes for adding items
    	itemName = new JTextField(10);
    	String name = nameModel.getElementAt(nameList.getSelectedIndex()).toString();
    	itemSerial = new JTextField(10);
    	String serial = serialModel.getElementAt(serialList.getSelectedIndex()).toString();
    	itemAmount = new JTextField(10);
    	String amount = amountModel.getElementAt(amountList.getSelectedIndex()).toString();
    	itemPrice = new JTextField(10);
    	String price = priceModel.getElementAt(priceList.getSelectedIndex()).toString();
    	
    	//panels for holding buttons and scroll panes
    	JPanel panel1 = new JPanel();
    	panel1.setBackground(new Color(46, 139, 87));
    	JPanel panel2 = new JPanel();
    	panel2.setBackground(new Color(46, 139, 87));
    	JPanel panel3 = new JPanel();
   		panel3.setBackground(new Color(46, 139, 87));
    	
    	JPanel center = new JPanel(new BorderLayout());
    	center.setBackground(new Color(46, 139, 87));
    	center.add(new JLabel("\n"), BorderLayout.SOUTH);
    	center.add(new JLabel("   "), BorderLayout.WEST);
    	center.add(new JLabel("   "), BorderLayout.EAST);
    	details.add(center);
    	panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    	panel2.add(nameListScroll, BorderLayout.CENTER);
    	panel2.add(serialListScroll, BorderLayout.NORTH);
    	panel2.add(priceListScroll, BorderLayout.NORTH);
    	panel2.add(amountListScroll, BorderLayout.NORTH);
    	center.add(nameOfItem, BorderLayout.NORTH);
    	center.add(panel2, BorderLayout.CENTER);
    	
    	//panel for holding navigation buttons
    	panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
		panel3.setBackground(new Color(46, 139, 87));
		panel3.add(new JLabel("             "), BorderLayout.WEST);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(inventoryDepartment, BorderLayout.NORTH);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(accounting, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(invoices, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(exitSystem, BorderLayout.SOUTH);
		panel3.add(new JLabel("                     "), BorderLayout.EAST);
		details.add(panel3, BorderLayout.NORTH);
	    	
    	//adding items to panels
    	panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    	panel1.add(search);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(itemName);
    	panel1.add(itemSerial);
    	panel1.add(itemPrice);
    	panel1.add(itemAmount);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(add);
    	panel1.add(delete);
    	panel1.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    	details.add(panel1, BorderLayout.PAGE_END);
    	
    	//listeners for buttons
    	add.addActionListener(new ButtonListener());
    	delete.addActionListener(new ButtonListener());
    	search.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accounting.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    	exitSystem.addActionListener(new ButtonListener());
    		   
    }
		
		public void valueChanged(ListSelectionEvent e)
		{
			int x = nameList.getSelectedIndex();
			amountList.setSelectedIndex(x);
			priceList.setSelectedIndex(x);
			serialList.setSelectedIndex(x);
		}
		
		
		public class ButtonListener implements ActionListener
		{
			public void actionPerformed(ActionEvent event){
				if(event.getSource() == add)
				{
					String name = itemName.getText();
					String serial = itemSerial.getText();
					String price = itemPrice.getText();
					String amount = itemAmount.getText();
					
					if(name.equals(""))
					{
						itemName.requestFocusInWindow();
						itemName.selectAll();
						return;
					}
					
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					if(index == -1)
					{
						index = 0;
					}
					else
					{
						index++;
					}
					
					nameModel.addElement(itemName.getText());
					serialModel.addElement(itemSerial.getText());
					priceModel.addElement(itemPrice.getText());
					amountModel.addElement(itemAmount.getText());
									
					nameList.setSelectedIndex(index);
					nameList.ensureIndexIsVisible(index);
					
					
				}
				if(event.getSource() == delete)
				{
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					
				}
				if(event.getSource() == search)
				{
					String text = itemName.getText();
    					if(nameModel.contains(text))
    					{
    						int index = nameModel.indexOf(text);
    						nameList.setSelectedIndex(index);
    						amountList.setSelectedIndex(index);
    						priceList.setSelectedIndex(index);
    						serialList.setSelectedIndex(index);
    						
    					}
				}
				if(event.getSource() == accounting)
				{
						//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == inventoryDepartment)
				{
						//creating the new frame for the inventory department page
    				JFrame frame2 = new JFrame("Inventory Department");
    				frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame2.getContentPane().add(new InventoryDepartment());
    				frame2.pack();
    				frame2.setVisible(true);
    				frame2.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == invoices)
				{
					//creating the new frame for the invoices
    				JFrame frame5 = new JFrame("Invoices");
    				frame5.setBackground(new Color(46,139, 87)); 
    				frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame5.getContentPane().add(new InvoicesAvailable());
    				frame5.setVisible(true);
    				frame5.setSize(600,590);   
				}
				if(event.getSource() == exitSystem)
				{
					 System.exit(0);
				}
			}
		}
}



Women's Low Socks
/**
 * Name: DetailsTwo.java
 * Function: This lists the items located in the Women's Low Socks Category.
 *
 */

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

public class DetailsTwo extends JPanel implements ListSelectionListener {
    
  	private JList nameList, serialList, amountList, priceList;
  	DefaultListModel nameModel, serialModel, amountModel, priceModel;
  	private static final String addString = "Add Item";
  	private static final String deleteString = "Delete Item";
  	private static final String searchString = "Search";
  	private JButton add, delete, search;
  	private JTextField itemName, itemSerial, itemAmount, itemPrice;
  	private JButton accounting, inventoryDepartment, exitSystem, invoices;
  	
  	
    public DetailsTwo() {
    	
    	//main panel
    	JPanel main = new JPanel();
    	main.setBackground(new Color(46, 139, 87));
    	main.setPreferredSize(new Dimension(800,800));
    	add(main);
    	
    	JPanel details = new JPanel();
    	details.setLayout(new BorderLayout());
   		details.setBackground(new Color(46, 139, 87));
    	details.setPreferredSize(new Dimension(600,600));
    	main.add(details);
    	
    	//label to list names of columns
    	JLabel nameOfItem = new JLabel("      Category of Item:    Serial Number:   Price of Item:  Amount of Item:  ");
    	nameOfItem.setForeground(new Color(240, 250, 240));
    	Font title = new Font("Bradley Hand ITC", Font.PLAIN, 20);
    	nameOfItem.setPreferredSize(new Dimension(100,100));
    	nameOfItem.setFont(title);
    	
    	//creating the list of inventory
    	nameModel = new DefaultListModel();
    	serialModel = new DefaultListModel();
    	priceModel = new DefaultListModel();
    	amountModel = new DefaultListModel();
    	
    	nameModel.addElement("Low Socks(Pink)");
    	nameModel.addElement("Low Socks(Black)");
    	nameModel.addElement("Low Socks(Red)");
    	nameModel.addElement("Low Socks(Orange))");
    	nameModel.addElement("Low Socks(Blue)");
    	
    	serialModel.addElement("34-75-860");
    	serialModel.addElement("34-75-900");
    	serialModel.addElement("34-75-756");
    	serialModel.addElement("34-75-234");
    	serialModel.addElement("34-75-598");
    	
    	
    	priceModel.addElement("5.89");
    	priceModel.addElement("5.89");
    	priceModel.addElement("5.89");
    	priceModel.addElement("5.89");
    	priceModel.addElement("5.89");
    	
    	amountModel.addElement("12");
    	amountModel.addElement("25");
    	amountModel.addElement("10");
    	amountModel.addElement("34");
    	amountModel.addElement("23");

    	
    	//creating panels that hold list
    	nameList = new JList(nameModel);
    	nameList.setBackground(new Color(240,250,240));
    	nameList.setForeground(new Color(46,139,87));
    	nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	nameList.setSelectedIndex(0);
    	nameList.setVisibleRowCount(5);
//    	nameList.addListSelectionListener(this);
    	JScrollPane nameListScroll = new JScrollPane(nameList);
    	
    	serialList = new JList(serialModel);
    	serialList.setBackground(new Color(240,250,240));
    	serialList.setForeground(new Color(46,139,87));
    	serialList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	serialList.setSelectedIndex(0);
    	serialList.setVisibleRowCount(5);
//    	serialList.addListSelectionListener(this);
    	JScrollPane serialListScroll = new JScrollPane(serialList);
    	
    	
    	priceList = new JList(priceModel);
    	priceList.setBackground(new Color(240,250,240));
    	priceList.setForeground(new Color(46, 139, 87));
    	priceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	priceList.setSelectedIndex(0);
    	priceList.setVisibleRowCount(5);
    	//priceList.addListSelectionListener(this);
    	JScrollPane priceListScroll = new JScrollPane(priceList);
    	
    	amountList = new JList(amountModel); 
    	amountList.setBackground(new Color(240,250,240));
    	amountList.setForeground(new Color(46,139,87));
    	amountList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	amountList.setSelectedIndex(0);
    	amountList.setVisibleRowCount(5);
//    	amountList.addListSelectionListener(this);
    	JScrollPane amountListScroll = new JScrollPane(amountList);
    	    
    	//adding item buttons
    	add = new JButton(addString);
    	delete = new JButton(deleteString);
    	search = new JButton(searchString);
    	accounting = new JButton("Accounting Department");
    	inventoryDepartment = new JButton("Inventory Department");
    	invoices = new JButton("Invoices");
    	exitSystem = new JButton("Exit System");
    	
    	//text boxes for adding items
    	itemName = new JTextField(10);
    	String name = nameModel.getElementAt(nameList.getSelectedIndex()).toString();
    	itemSerial = new JTextField(10);
    	String serial = serialModel.getElementAt(serialList.getSelectedIndex()).toString();
    	itemAmount = new JTextField(10);
    	String amount = amountModel.getElementAt(amountList.getSelectedIndex()).toString();
    	itemPrice = new JTextField(10);
    	String price = priceModel.getElementAt(priceList.getSelectedIndex()).toString();
    	
    	//panels for holding buttons and scroll panes
    	JPanel panel1 = new JPanel();
    	panel1.setBackground(new Color(46, 139, 87));
    	JPanel panel2 = new JPanel();
    	panel2.setBackground(new Color(46, 139, 87));
    	JPanel panel3 = new JPanel();
   		panel3.setBackground(new Color(46, 139, 87));
    	
    	JPanel center = new JPanel(new BorderLayout());
    	center.setBackground(new Color(46, 139, 87));
    	center.add(new JLabel("\n"), BorderLayout.SOUTH);
    	center.add(new JLabel("   "), BorderLayout.WEST);
    	center.add(new JLabel("   "), BorderLayout.EAST);
    	details.add(center);
    	panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    	panel2.add(nameListScroll, BorderLayout.CENTER);
    	panel2.add(serialListScroll, BorderLayout.NORTH);
    	panel2.add(priceListScroll, BorderLayout.NORTH);
    	panel2.add(amountListScroll, BorderLayout.NORTH);
    	center.add(nameOfItem, BorderLayout.NORTH);
    	center.add(panel2, BorderLayout.CENTER);
    	
    	//panel for holding navigation buttons
    	panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
		panel3.setBackground(new Color(46, 139, 87));
		panel3.add(new JLabel("             "), BorderLayout.WEST);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(inventoryDepartment, BorderLayout.NORTH);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(accounting, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(invoices, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(exitSystem, BorderLayout.SOUTH);
		panel3.add(new JLabel("                     "), BorderLayout.EAST);
		details.add(panel3, BorderLayout.NORTH);
	    	
    	//adding items to panels
    	panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    	panel1.add(search);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(itemName);
    	panel1.add(itemSerial);
    	panel1.add(itemPrice);
    	panel1.add(itemAmount);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(add);
    	panel1.add(delete);
    	panel1.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    	details.add(panel1, BorderLayout.PAGE_END);
    	
    	//listeners for buttons
    	add.addActionListener(new ButtonListener());
    	delete.addActionListener(new ButtonListener());
    	search.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accounting.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    	exitSystem.addActionListener(new ButtonListener());
    		   
    }
		
		public void valueChanged(ListSelectionEvent e)
		{
			int x = nameList.getSelectedIndex();
			amountList.setSelectedIndex(x);
			priceList.setSelectedIndex(x);
			serialList.setSelectedIndex(x);
		}
		
		
		public class ButtonListener implements ActionListener
		{
			public void actionPerformed(ActionEvent event){
				if(event.getSource() == add)
				{
					String name = itemName.getText();
					String serial = itemSerial.getText();
					String price = itemPrice.getText();
					String amount = itemAmount.getText();
					
					if(name.equals(""))
					{
						itemName.requestFocusInWindow();
						itemName.selectAll();
						return;
					}
					
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					if(index == -1)
					{
						index = 0;
					}
					else
					{
						index++;
					}
					
					nameModel.addElement(itemName.getText());
					serialModel.addElement(itemSerial.getText());
					priceModel.addElement(itemPrice.getText());
					amountModel.addElement(itemAmount.getText());
									
					nameList.setSelectedIndex(index);
					nameList.ensureIndexIsVisible(index);
					
					
				}
				if(event.getSource() == delete)
				{
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					
				}
				if(event.getSource() == search)
				{
					String text = itemName.getText();
    					if(nameModel.contains(text))
    					{
    						int index = nameModel.indexOf(text);
    						nameList.setSelectedIndex(index);
    						amountList.setSelectedIndex(index);
    						priceList.setSelectedIndex(index);
    						serialList.setSelectedIndex(index);
    						
    					}
				}
				if(event.getSource() == accounting)
				{
						//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == invoices)
				{
					//creating the new frame for the invoices
    				JFrame frame5 = new JFrame("Invoices");
    				frame5.setBackground(new Color(46,139, 87)); 
    				frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame5.getContentPane().add(new InvoicesAvailable());
    				frame5.setVisible(true);
    				frame5.setSize(600,590);   
				}
				if(event.getSource() == exitSystem)
				{
					 System.exit(0);
				}
				if(event.getSource() == inventoryDepartment)
				{
						//creating the new frame for the inventory department page
    				JFrame frame2 = new JFrame("Inventory Department");
    				frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame2.getContentPane().add(new InventoryDepartment());
    				frame2.pack();
    				frame2.setVisible(true);
    				frame2.setBackground(new Color(46, 139, 87));
				}
			}
		}

        
    
}



Women's High Socks
/**
 * Name: DetailsThree.java
 * Function: This lists the items located in the Women's High Socks Category.
 *
 */
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import javax.swing.event.*;

public class DetailsThree extends JPanel implements ListSelectionListener {
    
  	private JList nameList, serialList, amountList, priceList;
  	DefaultListModel nameModel, serialModel, amountModel, priceModel;
  	private static final String addString = "Add Item";
  	private static final String deleteString = "Delete Item";
  	private static final String searchString = "Search";
  	private JButton add, delete, search;
  	private JTextField itemName, itemSerial, itemAmount, itemPrice;
  	private JButton accounting, inventoryDepartment, exitSystem, invoices;
  	
  	
    public DetailsThree() {
    	
    	//main panel
    	JPanel main = new JPanel();
    	main.setBackground(new Color(46, 139, 87));
    	main.setPreferredSize(new Dimension(800,800));
    	add(main);
    	
    	JPanel details = new JPanel();
    	details.setLayout(new BorderLayout());
   		details.setBackground(new Color(46, 139, 87));
    	details.setPreferredSize(new Dimension(600,600));
    	main.add(details);
    	
    	//label to list names of columns
    	JLabel nameOfItem = new JLabel("      Category of Item:    Serial Number:   Price of Item:  Amount of Item:  ");
    	nameOfItem.setForeground(new Color(240, 250, 240));
    	Font title = new Font("Bradley Hand ITC", Font.PLAIN, 20);
    	nameOfItem.setPreferredSize(new Dimension(100,100));
    	nameOfItem.setFont(title);
    	
    	//creating the list of inventory
    	nameModel = new DefaultListModel();
    	serialModel = new DefaultListModel();
    	priceModel = new DefaultListModel();
    	amountModel = new DefaultListModel();
    	
    	nameModel.addElement("High Socks(Pink)");
    	nameModel.addElement("High Socks(Black)");
    	nameModel.addElement("High Socks(Red)");
    	nameModel.addElement("High Socks(Orange)");
    	nameModel.addElement("High Socks(Blue)");
    	
    	serialModel.addElement("34-80-860");
    	serialModel.addElement("34-80-900");
    	serialModel.addElement("34-80-756");
    	serialModel.addElement("34-80-234");
    	serialModel.addElement("34-80-598");
    	
    	
    	priceModel.addElement("7.89");
    	priceModel.addElement("7.89");
    	priceModel.addElement("7.89");
    	priceModel.addElement("7.89");
    	priceModel.addElement("7.89");
    	
    	amountModel.addElement("45");
    	amountModel.addElement("5");
    	amountModel.addElement("21");
    	amountModel.addElement("17");
    	amountModel.addElement("55");

    	
    	//creating panels that hold list
    	nameList = new JList(nameModel);
    	nameList.setBackground(new Color(240,250,240));
    	nameList.setForeground(new Color(46,139,87));
    	nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	nameList.setSelectedIndex(0);
    	nameList.setVisibleRowCount(5);
//    	nameList.addListSelectionListener(this);
    	JScrollPane nameListScroll = new JScrollPane(nameList);
    	
    	serialList = new JList(serialModel);
    	serialList.setBackground(new Color(240,250,240));
    	serialList.setForeground(new Color(46,139,87));
    	serialList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	serialList.setSelectedIndex(0);
    	serialList.setVisibleRowCount(5);
//    	serialList.addListSelectionListener(this);
    	JScrollPane serialListScroll = new JScrollPane(serialList);
    	
    	
    	priceList = new JList(priceModel);
    	priceList.setBackground(new Color(240,250,240));
    	priceList.setForeground(new Color(46, 139, 87));
    	priceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	priceList.setSelectedIndex(0);
    	priceList.setVisibleRowCount(5);
    	//priceList.addListSelectionListener(this);
    	JScrollPane priceListScroll = new JScrollPane(priceList);
    	
    	amountList = new JList(amountModel); 
    	amountList.setBackground(new Color(240,250,240));
    	amountList.setForeground(new Color(46,139,87));
    	amountList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	amountList.setSelectedIndex(0);
    	amountList.setVisibleRowCount(5);
//    	amountList.addListSelectionListener(this);
    	JScrollPane amountListScroll = new JScrollPane(amountList);
    	    
    	//adding item buttons
    	add = new JButton(addString);
    	delete = new JButton(deleteString);
    	search = new JButton(searchString);
    	accounting = new JButton("Accounting Department");
    	inventoryDepartment = new JButton("Inventory Department");
    	invoices = new JButton("Invoices");
    	exitSystem = new JButton("Exit System");
    	
    	//text boxes for adding items
    	itemName = new JTextField(10);
    	String name = nameModel.getElementAt(nameList.getSelectedIndex()).toString();
    	itemSerial = new JTextField(10);
    	String serial = serialModel.getElementAt(serialList.getSelectedIndex()).toString();
    	itemAmount = new JTextField(10);
    	String amount = amountModel.getElementAt(amountList.getSelectedIndex()).toString();
    	itemPrice = new JTextField(10);
    	String price = priceModel.getElementAt(priceList.getSelectedIndex()).toString();
    	
    	//panels for holding buttons and scroll panes
    	JPanel panel1 = new JPanel();
    	panel1.setBackground(new Color(46, 139, 87));
    	JPanel panel2 = new JPanel();
    	panel2.setBackground(new Color(46, 139, 87));
    	JPanel panel3 = new JPanel();
   		panel3.setBackground(new Color(46, 139, 87));
    	
    	JPanel center = new JPanel(new BorderLayout());
    	center.setBackground(new Color(46, 139, 87));
    	center.add(new JLabel("\n"), BorderLayout.SOUTH);
    	center.add(new JLabel("   "), BorderLayout.WEST);
    	center.add(new JLabel("   "), BorderLayout.EAST);
    	details.add(center);
    	panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    	panel2.add(nameListScroll, BorderLayout.CENTER);
    	panel2.add(serialListScroll, BorderLayout.NORTH);
    	panel2.add(priceListScroll, BorderLayout.NORTH);
    	panel2.add(amountListScroll, BorderLayout.NORTH);
    	center.add(nameOfItem, BorderLayout.NORTH);
    	center.add(panel2, BorderLayout.CENTER);
    	
    	//panel for holding navigation buttons
    	panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
		panel3.setBackground(new Color(46, 139, 87));
		panel3.add(new JLabel("             "), BorderLayout.WEST);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(inventoryDepartment, BorderLayout.NORTH);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(accounting, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(invoices, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(exitSystem, BorderLayout.SOUTH);
		panel3.add(new JLabel("                     "), BorderLayout.EAST);
		details.add(panel3, BorderLayout.NORTH);
	    	
    	//adding items to panels
    	panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    	panel1.add(search);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(itemName);
    	panel1.add(itemSerial);
    	panel1.add(itemPrice);
    	panel1.add(itemAmount);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(add);
    	panel1.add(delete);
    	panel1.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    	details.add(panel1, BorderLayout.PAGE_END);
    	
    	//listeners for buttons
    	add.addActionListener(new ButtonListener());
    	delete.addActionListener(new ButtonListener());
    	search.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accounting.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    	exitSystem.addActionListener(new ButtonListener());
    		   
    }
		
		public void valueChanged(ListSelectionEvent e)
		{
			int x = nameList.getSelectedIndex();
			amountList.setSelectedIndex(x);
			priceList.setSelectedIndex(x);
			serialList.setSelectedIndex(x);
		}
		
		
		public class ButtonListener implements ActionListener
		{
			public void actionPerformed(ActionEvent event){
				if(event.getSource() == add)
				{
					String name = itemName.getText();
					String serial = itemSerial.getText();
					String price = itemPrice.getText();
					String amount = itemAmount.getText();
					
					if(name.equals(""))
					{
						itemName.requestFocusInWindow();
						itemName.selectAll();
						return;
					}
					
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					if(index == -1)
					{
						index = 0;
					}
					else
					{
						index++;
					}
					
					nameModel.addElement(itemName.getText());
					serialModel.addElement(itemSerial.getText());
					priceModel.addElement(itemPrice.getText());
					amountModel.addElement(itemAmount.getText());
									
					nameList.setSelectedIndex(index);
					nameList.ensureIndexIsVisible(index);
					
					
				}
				if(event.getSource() == delete)
				{
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					
				}
				if(event.getSource() == search)
				{
					String text = itemName.getText();
    					if(nameModel.contains(text))
    					{
    						int index = nameModel.indexOf(text);
    						nameList.setSelectedIndex(index);
    						amountList.setSelectedIndex(index);
    						priceList.setSelectedIndex(index);
    						serialList.setSelectedIndex(index);
    						
    					}
				}
				if(event.getSource() == accounting)
				{
						//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == inventoryDepartment)
				{
						//creating the new frame for the inventory department page
    				JFrame frame2 = new JFrame("Inventory Department");
    				frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame2.getContentPane().add(new InventoryDepartment());
    				frame2.pack();
    				frame2.setVisible(true);
    				frame2.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == invoices)
				{
					//creating the new frame for the invoices
    				JFrame frame5 = new JFrame("Invoices");
    				frame5.setBackground(new Color(46,139, 87)); 
    				frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame5.getContentPane().add(new InvoicesAvailable());
    				frame5.setVisible(true);
    				frame5.setSize(600,590);   
				}
				if(event.getSource() == exitSystem)
				{
					 System.exit(0);
				}
			}
		}

        
    
}



Men's Crew shirts
/**
 * Name: DetailsFour.java
 * Function: This lists the items located in the Men's Crew T-Shirts Category.
 *
 */
 import javax.swing.event.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;

public class DetailsFour extends JPanel implements ListSelectionListener {
    
  	private JList nameList, serialList, amountList, priceList;
  	DefaultListModel nameModel, serialModel, amountModel, priceModel;
  	private static final String addString = "Add Item";
  	private static final String deleteString = "Delete Item";
  	private static final String searchString = "Search";
  	private JButton add, delete, search;
  	private JTextField itemName, itemSerial, itemAmount, itemPrice;
  	private JButton accounting, inventoryDepartment, exitSystem, invoices;
  	
  	
    public DetailsFour() {
    	
    	//main panel
    	JPanel main = new JPanel();
    	main.setBackground(new Color(46, 139, 87));
    	main.setPreferredSize(new Dimension(800,800));
    	add(main);
    	
    	JPanel details = new JPanel();
    	details.setLayout(new BorderLayout());
   		details.setBackground(new Color(46, 139, 87));
    	details.setPreferredSize(new Dimension(600,600));
    	main.add(details);
    	
    	//label to list names of columns
    	JLabel nameOfItem = new JLabel("      Category of Item:    Serial Number:   Price of Item:  Amount of Item:  ");
    	nameOfItem.setForeground(new Color(240, 250, 240));
    	Font title = new Font("Bradley Hand ITC", Font.PLAIN, 20);
    	nameOfItem.setPreferredSize(new Dimension(100,100));
    	nameOfItem.setFont(title);
    	
    	//creating the list of inventory
    	nameModel = new DefaultListModel();
    	serialModel = new DefaultListModel();
    	priceModel = new DefaultListModel();
    	amountModel = new DefaultListModel();
    	
    	nameModel.addElement("Crew T(Blue)");
    	nameModel.addElement("Crew T(Red)");
    	nameModel.addElement("Crew T(Orange)");
    	nameModel.addElement("Crew T(Black)");
    	nameModel.addElement("Crew T(Green)");
    	
    	serialModel.addElement("35-43-675");
    	serialModel.addElement("35-43-500");
    	serialModel.addElement("35-43-536");
    	serialModel.addElement("35-43-456");
    	serialModel.addElement("35-43-765");
    	
    	
    	priceModel.addElement("12.98");
    	priceModel.addElement("12.98");
    	priceModel.addElement("12.98");
    	priceModel.addElement("12.98");
    	priceModel.addElement("12.98");
    	
    	amountModel.addElement("19");
    	amountModel.addElement("24");
    	amountModel.addElement("15");
    	amountModel.addElement("23");
    	amountModel.addElement("6");

    	
    	//creating panels that hold list
    	nameList = new JList(nameModel);
    	nameList.setBackground(new Color(240,250,240));
    	nameList.setForeground(new Color(46,139,87));
    	nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	nameList.setSelectedIndex(0);
    	nameList.setVisibleRowCount(5);
//    	nameList.addListSelectionListener(this);
    	JScrollPane nameListScroll = new JScrollPane(nameList);
    	
    	serialList = new JList(serialModel);
    	serialList.setBackground(new Color(240,250,240));
    	serialList.setForeground(new Color(46,139,87));
    	serialList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	serialList.setSelectedIndex(0);
    	serialList.setVisibleRowCount(5);
//    	serialList.addListSelectionListener(this);
    	JScrollPane serialListScroll = new JScrollPane(serialList);
    	
    	
    	priceList = new JList(priceModel);
    	priceList.setBackground(new Color(240,250,240));
    	priceList.setForeground(new Color(46, 139, 87));
    	priceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	priceList.setSelectedIndex(0);
    	priceList.setVisibleRowCount(5);
    	//priceList.addListSelectionListener(this);
    	JScrollPane priceListScroll = new JScrollPane(priceList);
    	
    	amountList = new JList(amountModel); 
    	amountList.setBackground(new Color(240,250,240));
    	amountList.setForeground(new Color(46,139,87));
    	amountList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	amountList.setSelectedIndex(0);
    	amountList.setVisibleRowCount(5);
//    	amountList.addListSelectionListener(this);
    	JScrollPane amountListScroll = new JScrollPane(amountList);
    	    
    	//adding item buttons
    	add = new JButton(addString);
    	delete = new JButton(deleteString);
    	search = new JButton(searchString);
    	accounting = new JButton("Accounting Department");
    	inventoryDepartment = new JButton("Inventory Department");
    	invoices = new JButton("Invoices");
    	exitSystem = new JButton("Exit System");
    	
    	//text boxes for adding items
    	itemName = new JTextField(10);
    	String name = nameModel.getElementAt(nameList.getSelectedIndex()).toString();
    	itemSerial = new JTextField(10);
    	String serial = serialModel.getElementAt(serialList.getSelectedIndex()).toString();
    	itemAmount = new JTextField(10);
    	String amount = amountModel.getElementAt(amountList.getSelectedIndex()).toString();
    	itemPrice = new JTextField(10);
    	String price = priceModel.getElementAt(priceList.getSelectedIndex()).toString();
    	
    	//panels for holding buttons and scroll panes
    	JPanel panel1 = new JPanel();
    	panel1.setBackground(new Color(46, 139, 87));
    	JPanel panel2 = new JPanel();
    	panel2.setBackground(new Color(46, 139, 87));
    	JPanel panel3 = new JPanel();
   		panel3.setBackground(new Color(46, 139, 87));
    	
    	JPanel center = new JPanel(new BorderLayout());
    	center.setBackground(new Color(46, 139, 87));
    	center.add(new JLabel("\n"), BorderLayout.SOUTH);
    	center.add(new JLabel("   "), BorderLayout.WEST);
    	center.add(new JLabel("   "), BorderLayout.EAST);
    	details.add(center);
    	panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    	panel2.add(nameListScroll, BorderLayout.CENTER);
    	panel2.add(serialListScroll, BorderLayout.NORTH);
    	panel2.add(priceListScroll, BorderLayout.NORTH);
    	panel2.add(amountListScroll, BorderLayout.NORTH);
    	center.add(nameOfItem, BorderLayout.NORTH);
    	center.add(panel2, BorderLayout.CENTER);
    	
    	//panel for holding navigation buttons
    	panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
		panel3.setBackground(new Color(46, 139, 87));
		panel3.add(new JLabel("             "), BorderLayout.WEST);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(inventoryDepartment, BorderLayout.NORTH);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(accounting, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(invoices, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(exitSystem, BorderLayout.SOUTH);
		panel3.add(new JLabel("                     "), BorderLayout.EAST);
		details.add(panel3, BorderLayout.NORTH);
	    	
    	//adding items to panels
    	panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    	panel1.add(search);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(itemName);
    	panel1.add(itemSerial);
    	panel1.add(itemPrice);
    	panel1.add(itemAmount);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(add);
    	panel1.add(delete);
    	panel1.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    	details.add(panel1, BorderLayout.PAGE_END);
    	
    	//listeners for buttons
    	add.addActionListener(new ButtonListener());
    	delete.addActionListener(new ButtonListener());
    	search.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accounting.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    	exitSystem.addActionListener(new ButtonListener());
    		   
    }
		
		public void valueChanged(ListSelectionEvent e)
		{
			int x = nameList.getSelectedIndex();
			amountList.setSelectedIndex(x);
			priceList.setSelectedIndex(x);
			serialList.setSelectedIndex(x);
		}
		
		
		public class ButtonListener implements ActionListener
		{
			public void actionPerformed(ActionEvent event){
				if(event.getSource() == add)
				{
					String name = itemName.getText();
					String serial = itemSerial.getText();
					String price = itemPrice.getText();
					String amount = itemAmount.getText();
					
					if(name.equals(""))
					{
						itemName.requestFocusInWindow();
						itemName.selectAll();
						return;
					}
					
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					if(index == -1)
					{
						index = 0;
					}
					else
					{
						index++;
					}
					
					nameModel.addElement(itemName.getText());
					serialModel.addElement(itemSerial.getText());
					priceModel.addElement(itemPrice.getText());
					amountModel.addElement(itemAmount.getText());
									
					nameList.setSelectedIndex(index);
					nameList.ensureIndexIsVisible(index);
					
					
				}
				if(event.getSource() == delete)
				{
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					
				}
				if(event.getSource() == search)
				{
					String text = itemName.getText();
    					if(nameModel.contains(text))
    					{
    						int index = nameModel.indexOf(text);
    						nameList.setSelectedIndex(index);
    						amountList.setSelectedIndex(index);
    						priceList.setSelectedIndex(index);
    						serialList.setSelectedIndex(index);
    						
    					}
				}
				if(event.getSource() == accounting)
				{
						//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == inventoryDepartment)
				{
						//creating the new frame for the inventory department page
    				JFrame frame2 = new JFrame("Inventory Department");
    				frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame2.getContentPane().add(new InventoryDepartment());
    				frame2.pack();
    				frame2.setVisible(true);
    				frame2.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == invoices)
				{
					//creating the new frame for the invoices
    				JFrame frame5 = new JFrame("Invoices");
    				frame5.setBackground(new Color(46,139, 87)); 
    				frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame5.getContentPane().add(new InvoicesAvailable());
    				frame5.setVisible(true);
    				frame5.setSize(600,590);   
				}
				if(event.getSource() == exitSystem)
				{
					 System.exit(0);
				}
			}
		}

        
    
}



Men's V-Neck Shirts
/**
 * Name: DetailsFive.java
 * Function: This lists the items located in the Men's Crew T-Shirts Category.
 *
 */
import javax.swing.event.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;

public class DetailsFive extends JPanel implements ListSelectionListener {
    
  	private JList nameList, serialList, amountList, priceList;
  	DefaultListModel nameModel, serialModel, amountModel, priceModel;
  	private static final String addString = "Add Item";
  	private static final String deleteString = "Delete Item";
  	private static final String searchString = "Search";
  	private JButton add, delete, search;
  	private JTextField itemName, itemSerial, itemAmount, itemPrice;
  	private JButton accounting, inventoryDepartment, exitSystem, invoices;
  	
  	
    public DetailsFive() {
    	
    	//main panel
    	JPanel main = new JPanel();
    	main.setBackground(new Color(46, 139, 87));
    	main.setPreferredSize(new Dimension(800,800));
    	add(main);
    	
    	JPanel details = new JPanel();
    	details.setLayout(new BorderLayout());
   		details.setBackground(new Color(46, 139, 87));
    	details.setPreferredSize(new Dimension(600,600));
    	main.add(details);
    	
    	//label to list names of columns
    	JLabel nameOfItem = new JLabel("      Category of Item:    Serial Number:   Price of Item:  Amount of Item:  ");
    	nameOfItem.setForeground(new Color(240, 250, 240));
    	Font title = new Font("Bradley Hand ITC", Font.PLAIN, 20);
    	nameOfItem.setPreferredSize(new Dimension(100,100));
    	nameOfItem.setFont(title);
    	
    	//creating the list of inventory
    	nameModel = new DefaultListModel();
    	serialModel = new DefaultListModel();
    	priceModel = new DefaultListModel();
    	amountModel = new DefaultListModel();
    	
    	nameModel.addElement("V-Neck T(Blue)");
    	nameModel.addElement("V-Neck T(Red)");
    	nameModel.addElement("V-Neck T(Orange)");
    	nameModel.addElement("V-Neck T(Black)");
    	nameModel.addElement("V-Neck T(Green)");
    	
    	serialModel.addElement("35-60-453");
    	serialModel.addElement("35-60-500");
    	serialModel.addElement("35-60-536");
    	serialModel.addElement("35-60-456");
    	serialModel.addElement("35-60-765");
    	
    	
    	priceModel.addElement("13.89");
    	priceModel.addElement("13.89");
    	priceModel.addElement("13.89");
    	priceModel.addElement("13.89");
    	priceModel.addElement("13.89");
    	
    	amountModel.addElement("24");
    	amountModel.addElement("42");
    	amountModel.addElement("14");
    	amountModel.addElement("27");
    	amountModel.addElement("37");

    	
    	//creating panels that hold list
    	nameList = new JList(nameModel);
    	nameList.setBackground(new Color(240,250,240));
    	nameList.setForeground(new Color(46,139,87));
    	nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	nameList.setSelectedIndex(0);
    	nameList.setVisibleRowCount(5);
//    	nameList.addListSelectionListener(this);
    	JScrollPane nameListScroll = new JScrollPane(nameList);
    	
    	serialList = new JList(serialModel);
    	serialList.setBackground(new Color(240,250,240));
    	serialList.setForeground(new Color(46,139,87));
    	serialList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	serialList.setSelectedIndex(0);
    	serialList.setVisibleRowCount(5);
//    	serialList.addListSelectionListener(this);
    	JScrollPane serialListScroll = new JScrollPane(serialList);
    	
    	
    	priceList = new JList(priceModel);
    	priceList.setBackground(new Color(240,250,240));
    	priceList.setForeground(new Color(46, 139, 87));
    	priceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	priceList.setSelectedIndex(0);
    	priceList.setVisibleRowCount(5);
    	//priceList.addListSelectionListener(this);
    	JScrollPane priceListScroll = new JScrollPane(priceList);
    	
    	amountList = new JList(amountModel); 
    	amountList.setBackground(new Color(240,250,240));
    	amountList.setForeground(new Color(46,139,87));
    	amountList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	amountList.setSelectedIndex(0);
    	amountList.setVisibleRowCount(5);
//    	amountList.addListSelectionListener(this);
    	JScrollPane amountListScroll = new JScrollPane(amountList);
    	    
    	//adding item buttons
    	add = new JButton(addString);
    	delete = new JButton(deleteString);
    	search = new JButton(searchString);
    	accounting = new JButton("Accounting Department");
    	inventoryDepartment = new JButton("Inventory Department");
    	invoices = new JButton("Invoices");
    	exitSystem = new JButton("Exit System");
    	
    	//text boxes for adding items
    	itemName = new JTextField(10);
    	String name = nameModel.getElementAt(nameList.getSelectedIndex()).toString();
    	itemSerial = new JTextField(10);
    	String serial = serialModel.getElementAt(serialList.getSelectedIndex()).toString();
    	itemAmount = new JTextField(10);
    	String amount = amountModel.getElementAt(amountList.getSelectedIndex()).toString();
    	itemPrice = new JTextField(10);
    	String price = priceModel.getElementAt(priceList.getSelectedIndex()).toString();
    	
    	//panels for holding buttons and scroll panes
    	JPanel panel1 = new JPanel();
    	panel1.setBackground(new Color(46, 139, 87));
    	JPanel panel2 = new JPanel();
    	panel2.setBackground(new Color(46, 139, 87));
    	JPanel panel3 = new JPanel();
   		panel3.setBackground(new Color(46, 139, 87));
    	
    	JPanel center = new JPanel(new BorderLayout());
    	center.setBackground(new Color(46, 139, 87));
    	center.add(new JLabel("\n"), BorderLayout.SOUTH);
    	center.add(new JLabel("   "), BorderLayout.WEST);
    	center.add(new JLabel("   "), BorderLayout.EAST);
    	details.add(center);
    	panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    	panel2.add(nameListScroll, BorderLayout.CENTER);
    	panel2.add(serialListScroll, BorderLayout.NORTH);
    	panel2.add(priceListScroll, BorderLayout.NORTH);
    	panel2.add(amountListScroll, BorderLayout.NORTH);
    	center.add(nameOfItem, BorderLayout.NORTH);
    	center.add(panel2, BorderLayout.CENTER);
    	
    	//panel for holding navigation buttons
    	panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
		panel3.setBackground(new Color(46, 139, 87));
		panel3.add(new JLabel("             "), BorderLayout.WEST);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(inventoryDepartment, BorderLayout.NORTH);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(accounting, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(invoices, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(exitSystem, BorderLayout.SOUTH);
		panel3.add(new JLabel("                     "), BorderLayout.EAST);
		details.add(panel3, BorderLayout.NORTH);
	    	
    	//adding items to panels
    	panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    	panel1.add(search);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(itemName);
    	panel1.add(itemSerial);
    	panel1.add(itemPrice);
    	panel1.add(itemAmount);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(add);
    	panel1.add(delete);
    	panel1.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    	details.add(panel1, BorderLayout.PAGE_END);
    	
    	//listeners for buttons
    	add.addActionListener(new ButtonListener());
    	delete.addActionListener(new ButtonListener());
    	search.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accounting.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    	exitSystem.addActionListener(new ButtonListener());
    		   
    }
		
		public void valueChanged(ListSelectionEvent e)
		{
			int x = nameList.getSelectedIndex();
			amountList.setSelectedIndex(x);
			priceList.setSelectedIndex(x);
			serialList.setSelectedIndex(x);
		}
		
		
		public class ButtonListener implements ActionListener
		{
			public void actionPerformed(ActionEvent event){
				if(event.getSource() == add)
				{
					String name = itemName.getText();
					String serial = itemSerial.getText();
					String price = itemPrice.getText();
					String amount = itemAmount.getText();
					
					if(name.equals(""))
					{
						itemName.requestFocusInWindow();
						itemName.selectAll();
						return;
					}
					
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					if(index == -1)
					{
						index = 0;
					}
					else
					{
						index++;
					}
					
					nameModel.addElement(itemName.getText());
					serialModel.addElement(itemSerial.getText());
					priceModel.addElement(itemPrice.getText());
					amountModel.addElement(itemAmount.getText());
									
					nameList.setSelectedIndex(index);
					nameList.ensureIndexIsVisible(index);
					
					
				}
				if(event.getSource() == delete)
				{
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					
				}
				if(event.getSource() == search)
				{
					String text = itemName.getText();
    					if(nameModel.contains(text))
    					{
    						int index = nameModel.indexOf(text);
    						nameList.setSelectedIndex(index);
    						amountList.setSelectedIndex(index);
    						priceList.setSelectedIndex(index);
    						serialList.setSelectedIndex(index);
    						
    					}
				}
				if(event.getSource() == accounting)
				{
						//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == inventoryDepartment)
				{
						//creating the new frame for the inventory department page
    				JFrame frame2 = new JFrame("Inventory Department");
    				frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame2.getContentPane().add(new InventoryDepartment());
    				frame2.pack();
    				frame2.setVisible(true);
    				frame2.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == invoices)
				{
					//creating the new frame for the invoices
    				JFrame frame5 = new JFrame("Invoices");
    				frame5.setBackground(new Color(46,139, 87)); 
    				frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame5.getContentPane().add(new InvoicesAvailable());
    				frame5.setVisible(true);
    				frame5.setSize(600,590);   
				}
				if(event.getSource() == exitSystem)
				{
					 System.exit(0);
				}
			}
		}

        
    
}



Men's Low Socks
/**
 * Name: DetailsSix.java
 * Function: This lists the items located in the Men's Low Socks Category.
 *
 */
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import javax.swing.event.*;

public class DetailsSix extends JPanel implements ListSelectionListener {
    
  	private JList nameList, serialList, amountList, priceList;
  	DefaultListModel nameModel, serialModel, amountModel, priceModel;
  	private static final String addString = "Add Item";
  	private static final String deleteString = "Delete Item";
  	private static final String searchString = "Search";
  	private JButton add, delete, search;
  	private JTextField itemName, itemSerial, itemAmount, itemPrice;
  	private JButton accounting, inventoryDepartment, exitSystem, invoices;
  	
  	
    public DetailsSix() {
    	
    	//main panel
    	JPanel main = new JPanel();
    	main.setBackground(new Color(46, 139, 87));
    	main.setPreferredSize(new Dimension(800,800));
    	add(main);
    	
    	JPanel details = new JPanel();
    	details.setLayout(new BorderLayout());
   		details.setBackground(new Color(46, 139, 87));
    	details.setPreferredSize(new Dimension(600,600));
    	main.add(details);
    	
    	//label to list names of columns
    	JLabel nameOfItem = new JLabel("      Category of Item:    Serial Number:   Price of Item:  Amount of Item:  ");
    	nameOfItem.setForeground(new Color(240, 250, 240));
    	Font title = new Font("Bradley Hand ITC", Font.PLAIN, 20);
    	nameOfItem.setPreferredSize(new Dimension(100,100));
    	nameOfItem.setFont(title);
    	
    	//creating the list of inventory
    	nameModel = new DefaultListModel();
    	serialModel = new DefaultListModel();
    	priceModel = new DefaultListModel();
    	amountModel = new DefaultListModel();
    	
    	nameModel.addElement("Low Socks(Tan)");
    	nameModel.addElement("Low Socks(Black)");
    	nameModel.addElement("Low Socks(Red)");
    	nameModel.addElement("Low Socks(Brown)");
    	nameModel.addElement("Low Socks(Blue)");
    	
    	serialModel.addElement("35-75-860");
    	serialModel.addElement("35-75-900");
    	serialModel.addElement("35-75-756");
    	serialModel.addElement("35-75-234");
    	serialModel.addElement("35-75-598");
    	
    	
    	priceModel.addElement("5.89");
    	priceModel.addElement("5.89");
    	priceModel.addElement("5.89");
    	priceModel.addElement("5.89");
    	priceModel.addElement("5.89");
    	
    	amountModel.addElement("4");
    	amountModel.addElement("56");
    	amountModel.addElement("22");
    	amountModel.addElement("56");
    	amountModel.addElement("29");

    	
    	//creating panels that hold list
    	nameList = new JList(nameModel);
    	nameList.setBackground(new Color(240,250,240));
    	nameList.setForeground(new Color(46,139,87));
    	nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	nameList.setSelectedIndex(0);
    	nameList.setVisibleRowCount(5);
//    	nameList.addListSelectionListener(this);
    	JScrollPane nameListScroll = new JScrollPane(nameList);
    	
    	serialList = new JList(serialModel);
    	serialList.setBackground(new Color(240,250,240));
    	serialList.setForeground(new Color(46,139,87));
    	serialList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	serialList.setSelectedIndex(0);
    	serialList.setVisibleRowCount(5);
//    	serialList.addListSelectionListener(this);
    	JScrollPane serialListScroll = new JScrollPane(serialList);
    	
    	
    	priceList = new JList(priceModel);
    	priceList.setBackground(new Color(240,250,240));
    	priceList.setForeground(new Color(46, 139, 87));
    	priceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	priceList.setSelectedIndex(0);
    	priceList.setVisibleRowCount(5);
    	//priceList.addListSelectionListener(this);
    	JScrollPane priceListScroll = new JScrollPane(priceList);
    	
    	amountList = new JList(amountModel); 
    	amountList.setBackground(new Color(240,250,240));
    	amountList.setForeground(new Color(46,139,87));
    	amountList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	amountList.setSelectedIndex(0);
    	amountList.setVisibleRowCount(5);
//    	amountList.addListSelectionListener(this);
    	JScrollPane amountListScroll = new JScrollPane(amountList);
    	    
    	//adding item buttons
    	add = new JButton(addString);
    	delete = new JButton(deleteString);
    	search = new JButton(searchString);
    	accounting = new JButton("Accounting Department");
    	inventoryDepartment = new JButton("Inventory Department");
    	invoices = new JButton("Invoices");
    	exitSystem = new JButton("Exit System");
    	
    	//text boxes for adding items
    	itemName = new JTextField(10);
    	String name = nameModel.getElementAt(nameList.getSelectedIndex()).toString();
    	itemSerial = new JTextField(10);
    	String serial = serialModel.getElementAt(serialList.getSelectedIndex()).toString();
    	itemAmount = new JTextField(10);
    	String amount = amountModel.getElementAt(amountList.getSelectedIndex()).toString();
    	itemPrice = new JTextField(10);
    	String price = priceModel.getElementAt(priceList.getSelectedIndex()).toString();
    	
    	//panels for holding buttons and scroll panes
    	JPanel panel1 = new JPanel();
    	panel1.setBackground(new Color(46, 139, 87));
    	JPanel panel2 = new JPanel();
    	panel2.setBackground(new Color(46, 139, 87));
    	JPanel panel3 = new JPanel();
   		panel3.setBackground(new Color(46, 139, 87));
    	
    	JPanel center = new JPanel(new BorderLayout());
    	center.setBackground(new Color(46, 139, 87));
    	center.add(new JLabel("\n"), BorderLayout.SOUTH);
    	center.add(new JLabel("   "), BorderLayout.WEST);
    	center.add(new JLabel("   "), BorderLayout.EAST);
    	details.add(center);
    	panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    	panel2.add(nameListScroll, BorderLayout.CENTER);
    	panel2.add(serialListScroll, BorderLayout.NORTH);
    	panel2.add(priceListScroll, BorderLayout.NORTH);
    	panel2.add(amountListScroll, BorderLayout.NORTH);
    	center.add(nameOfItem, BorderLayout.NORTH);
    	center.add(panel2, BorderLayout.CENTER);
    	
    	//panel for holding navigation buttons
    	panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
		panel3.setBackground(new Color(46, 139, 87));
		panel3.add(new JLabel("             "), BorderLayout.WEST);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(inventoryDepartment, BorderLayout.NORTH);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(accounting, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(invoices, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(exitSystem, BorderLayout.SOUTH);
		panel3.add(new JLabel("                     "), BorderLayout.EAST);
		details.add(panel3, BorderLayout.NORTH);
	    	
    	//adding items to panels
    	panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    	panel1.add(search);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(itemName);
    	panel1.add(itemSerial);
    	panel1.add(itemPrice);
    	panel1.add(itemAmount);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(add);
    	panel1.add(delete);
    	panel1.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    	details.add(panel1, BorderLayout.PAGE_END);
    	
    	//listeners for buttons
    	add.addActionListener(new ButtonListener());
    	delete.addActionListener(new ButtonListener());
    	search.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accounting.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    	exitSystem.addActionListener(new ButtonListener());
    		   
    }
		
		public void valueChanged(ListSelectionEvent e)
		{
			int x = nameList.getSelectedIndex();
			amountList.setSelectedIndex(x);
			priceList.setSelectedIndex(x);
			serialList.setSelectedIndex(x);
		}
		
		
		public class ButtonListener implements ActionListener
		{
			public void actionPerformed(ActionEvent event){
				if(event.getSource() == add)
				{
					String name = itemName.getText();
					String serial = itemSerial.getText();
					String price = itemPrice.getText();
					String amount = itemAmount.getText();
					
					if(name.equals(""))
					{
						itemName.requestFocusInWindow();
						itemName.selectAll();
						return;
					}
					
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					if(index == -1)
					{
						index = 0;
					}
					else
					{
						index++;
					}
					
					nameModel.addElement(itemName.getText());
					serialModel.addElement(itemSerial.getText());
					priceModel.addElement(itemPrice.getText());
					amountModel.addElement(itemAmount.getText());
									
					nameList.setSelectedIndex(index);
					nameList.ensureIndexIsVisible(index);
					
					
				}
				if(event.getSource() == delete)
				{
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					
				}
				if(event.getSource() == search)
				{
					String text = itemName.getText();
    					if(nameModel.contains(text))
    					{
    						int index = nameModel.indexOf(text);
    						nameList.setSelectedIndex(index);
    						amountList.setSelectedIndex(index);
    						priceList.setSelectedIndex(index);
    						serialList.setSelectedIndex(index);
    					}
				}
				if(event.getSource() == accounting)
				{
						//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == inventoryDepartment)
				{
						//creating the new frame for the inventory department page
    				JFrame frame2 = new JFrame("Inventory Department");
    				frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame2.getContentPane().add(new InventoryDepartment());
    				frame2.pack();
    				frame2.setVisible(true);
    				frame2.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == invoices)
				{
					//creating the new frame for the invoices
    				JFrame frame5 = new JFrame("Invoices");
    				frame5.setBackground(new Color(46,139, 87)); 
    				frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame5.getContentPane().add(new InvoicesAvailable());
    				frame5.setVisible(true);
    				frame5.setSize(600,590);   
				}
				if(event.getSource() == exitSystem)
				{
					 System.exit(0);
				}
			}
		}

        
    
}



Men's High Socks
/**
 * Name: DetailsSeven.java
 * Function: This lists the items located in the Men's High Socks Category.
 *
 */
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import javax.swing.event.*;

public class DetailsSeven extends JPanel implements ListSelectionListener {
    
  	private JList nameList, serialList, amountList, priceList;
  	DefaultListModel nameModel, serialModel, amountModel, priceModel;
  	private static final String addString = "Add Item";
  	private static final String deleteString = "Delete Item";
  	private static final String searchString = "Search";
  	private JButton add, delete, search;
  	private JTextField itemName, itemSerial, itemAmount, itemPrice;
  	private JButton accounting, inventoryDepartment, exitSystem, invoices;
  	
  	
    public DetailsSeven() {
    	
    	//main panel
    	JPanel main = new JPanel();
    	main.setBackground(new Color(46, 139, 87));
    	main.setPreferredSize(new Dimension(800,800));
    	add(main);
    	
    	JPanel details = new JPanel();
    	details.setLayout(new BorderLayout());
   		details.setBackground(new Color(46, 139, 87));
    	details.setPreferredSize(new Dimension(600,600));
    	main.add(details);
    	
    	//label to list names of columns
    	JLabel nameOfItem = new JLabel("      Category of Item:    Serial Number:   Price of Item:  Amount of Item:  ");
    	nameOfItem.setForeground(new Color(240, 250, 240));
    	Font title = new Font("Bradley Hand ITC", Font.PLAIN, 20);
    	nameOfItem.setPreferredSize(new Dimension(100,100));
    	nameOfItem.setFont(title);
    	
    	//creating the list of inventory
    	nameModel = new DefaultListModel();
    	serialModel = new DefaultListModel();
    	priceModel = new DefaultListModel();
    	amountModel = new DefaultListModel();
    	
    	nameModel.addElement("High Socks(Tan)");
    	nameModel.addElement("High Socks(Black)");
    	nameModel.addElement("High Socks(Red)");
    	nameModel.addElement("High Socks(Brown)");
    	nameModel.addElement("High Socks(Blue)");
    	
    	serialModel.addElement("35-80-860");
    	serialModel.addElement("35-80-900");
    	serialModel.addElement("35-80-756");
    	serialModel.addElement("35-80-234");
    	serialModel.addElement("35-80-598");
    	
    	
    	priceModel.addElement("7.89");
    	priceModel.addElement("7.89");
    	priceModel.addElement("7.89");
    	priceModel.addElement("7.89");
    	priceModel.addElement("7.89");
    	
    	amountModel.addElement("55");
    	amountModel.addElement("10");
    	amountModel.addElement("44");
    	amountModel.addElement("23");
    	amountModel.addElement("52");

    	
    	//creating panels that hold list
    	nameList = new JList(nameModel);
    	nameList.setBackground(new Color(240,250,240));
    	nameList.setForeground(new Color(46,139,87));
    	nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	nameList.setSelectedIndex(0);
    	nameList.setVisibleRowCount(5);
//    	nameList.addListSelectionListener(this);
    	JScrollPane nameListScroll = new JScrollPane(nameList);
    	
    	serialList = new JList(serialModel);
    	serialList.setBackground(new Color(240,250,240));
    	serialList.setForeground(new Color(46,139,87));
    	serialList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	serialList.setSelectedIndex(0);
    	serialList.setVisibleRowCount(5);
//    	serialList.addListSelectionListener(this);
    	JScrollPane serialListScroll = new JScrollPane(serialList);
    	
    	
    	priceList = new JList(priceModel);
    	priceList.setBackground(new Color(240,250,240));
    	priceList.setForeground(new Color(46, 139, 87));
    	priceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	priceList.setSelectedIndex(0);
    	priceList.setVisibleRowCount(5);
    	//priceList.addListSelectionListener(this);
    	JScrollPane priceListScroll = new JScrollPane(priceList);
    	
    	amountList = new JList(amountModel); 
    	amountList.setBackground(new Color(240,250,240));
    	amountList.setForeground(new Color(46,139,87));
    	amountList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    	amountList.setSelectedIndex(0);
    	amountList.setVisibleRowCount(5);
//    	amountList.addListSelectionListener(this);
    	JScrollPane amountListScroll = new JScrollPane(amountList);
    	    
    	//adding item buttons
    	add = new JButton(addString);
    	delete = new JButton(deleteString);
    	search = new JButton(searchString);
    	accounting = new JButton("Accounting Department");
    	inventoryDepartment = new JButton("Inventory Department");
    	invoices = new JButton("Invoices");
    	exitSystem = new JButton("Exit System");
    	
    	//text boxes for adding items
    	itemName = new JTextField(10);
    	String name = nameModel.getElementAt(nameList.getSelectedIndex()).toString();
    	itemSerial = new JTextField(10);
    	String serial = serialModel.getElementAt(serialList.getSelectedIndex()).toString();
    	itemAmount = new JTextField(10);
    	String amount = amountModel.getElementAt(amountList.getSelectedIndex()).toString();
    	itemPrice = new JTextField(10);
    	String price = priceModel.getElementAt(priceList.getSelectedIndex()).toString();
    	
    	//panels for holding buttons and scroll panes
    	JPanel panel1 = new JPanel();
    	panel1.setBackground(new Color(46, 139, 87));
    	JPanel panel2 = new JPanel();
    	panel2.setBackground(new Color(46, 139, 87));
    	JPanel panel3 = new JPanel();
   		panel3.setBackground(new Color(46, 139, 87));
    	
    	JPanel center = new JPanel(new BorderLayout());
    	center.setBackground(new Color(46, 139, 87));
    	center.add(new JLabel("\n"), BorderLayout.SOUTH);
    	center.add(new JLabel("   "), BorderLayout.WEST);
    	center.add(new JLabel("   "), BorderLayout.EAST);
    	details.add(center);
    	panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    	panel2.add(nameListScroll, BorderLayout.CENTER);
    	panel2.add(serialListScroll, BorderLayout.NORTH);
    	panel2.add(priceListScroll, BorderLayout.NORTH);
    	panel2.add(amountListScroll, BorderLayout.NORTH);
    	center.add(nameOfItem, BorderLayout.NORTH);
    	center.add(panel2, BorderLayout.CENTER);
    	
    	//panel for holding navigation buttons
    	panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
		panel3.setBackground(new Color(46, 139, 87));
		panel3.add(new JLabel("             "), BorderLayout.WEST);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(inventoryDepartment, BorderLayout.NORTH);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(accounting, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(invoices, BorderLayout.CENTER);
		panel3.add(Box.createHorizontalStrut(5));
		panel3.add(exitSystem, BorderLayout.SOUTH);
		panel3.add(new JLabel("                     "), BorderLayout.EAST);
		details.add(panel3, BorderLayout.NORTH);
	    	
    	//adding items to panels
    	panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    	panel1.add(search);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(itemName);
    	panel1.add(itemSerial);
    	panel1.add(itemPrice);
    	panel1.add(itemAmount);
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(new JSeparator(SwingConstants.VERTICAL));
    	panel1.add(Box.createHorizontalStrut(5));
    	panel1.add(add);
    	panel1.add(delete);
    	panel1.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    	details.add(panel1, BorderLayout.PAGE_END);
    	
    	//listeners for buttons
    	add.addActionListener(new ButtonListener());
    	delete.addActionListener(new ButtonListener());
    	search.addActionListener(new ButtonListener());
    	inventoryDepartment.addActionListener(new ButtonListener());
    	accounting.addActionListener(new ButtonListener());
    	invoices.addActionListener(new ButtonListener());
    	exitSystem.addActionListener(new ButtonListener());
    		   
    }
		
		public void valueChanged(ListSelectionEvent e)
		{
			int x = nameList.getSelectedIndex();
			amountList.setSelectedIndex(x);
			priceList.setSelectedIndex(x);
			serialList.setSelectedIndex(x);
		}
		
		
		public class ButtonListener implements ActionListener
		{
			public void actionPerformed(ActionEvent event){
				if(event.getSource() == add)
				{
					String name = itemName.getText();
					String serial = itemSerial.getText();
					String price = itemPrice.getText();
					String amount = itemAmount.getText();
					
					if(name.equals(""))
					{
						itemName.requestFocusInWindow();
						itemName.selectAll();
						return;
					}
					
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					if(index == -1)
					{
						index = 0;
					}
					else
					{
						index++;
					}
					
					nameModel.addElement(itemName.getText());
					serialModel.addElement(itemSerial.getText());
					priceModel.addElement(itemPrice.getText());
					amountModel.addElement(itemAmount.getText());
									
					nameList.setSelectedIndex(index);
					nameList.ensureIndexIsVisible(index);
					
					
				}
				if(event.getSource() == delete)
				{
					int index = nameList.getSelectedIndex();
					int index2 = 0;
					int index3 = 0;
					int index4 = 0;
					index2 = index;
					index3 = index2;
					index4 = index3;
					
					
				}
				if(event.getSource() == search)
				{
					String text = itemName.getText();
    					if(nameModel.contains(text))
    					{
    						int index = nameModel.indexOf(text);
    						nameList.setSelectedIndex(index);
    						amountList.setSelectedIndex(index);
    						priceList.setSelectedIndex(index);
    						serialList.setSelectedIndex(index);
    					}
				}
				if(event.getSource() == accounting)
				{
						//creating the new frame for the accounting department page
    				JFrame frame3 = new JFrame("Accounting Department");
    				frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame3.getContentPane().add(new AccountingDepartment());
    				frame3.pack();
    				frame3.setVisible(true);
    				frame3.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == inventoryDepartment)
				{
						//creating the new frame for the inventory department page
    				JFrame frame2 = new JFrame("Inventory Department");
    				frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame2.getContentPane().add(new InventoryDepartment());
    				frame2.pack();
    				frame2.setVisible(true);
    				frame2.setBackground(new Color(46, 139, 87));
				}
				if(event.getSource() == invoices)
				{
					//creating the new frame for the invoices
    				JFrame frame5 = new JFrame("Invoices");
    				frame5.setBackground(new Color(46,139, 87)); 
    				frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    				frame5.getContentPane().add(new InvoicesAvailable());
    				frame5.setVisible(true);
    				frame5.setSize(600,590);   
				}
				if(event.getSource() == exitSystem)
				{
					 System.exit(0);
				}
			}
		}

        
    
}



Within the accounting department:
Payroll
/**
 * Name: Payroll.java
 * Function: handles the payroll of the warehouse inventory workers. This page is still under construction.
 */

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

 class MyFrame extends JFrame{
 
	MyFrame()
	{
		super("This is my application");
		add(new Payroll(this));
	}
 }

public class Payroll extends JPanel {
    JButton close;
    JFrame father;
    
    Payroll(JFrame father)
    {
    	this.father = father;
    }
    
    public Payroll()
    {
    	//panel to hold title
    	JPanel construction = new JPanel();
    	construction.setBackground(new Color(46, 139, 87));
    	construction.setPreferredSize(new Dimension(300,300));
    	add(construction);
    	
    	//title of Under Construction
    	JLabel title = new JLabel("Under Construction");
    	title.setForeground(new Color(240, 250, 240));
    	Font font = new Font("Bradley Hand ITC", Font.PLAIN, 30);
    	title.setFont(font);
    	construction.add(title);
    	
    	//button to close off the page - still under construction
    	close = new JButton("Close");
    	close.addActionListener(new ButtonListener());
    	close.setForeground(new Color(46, 139, 87));
    	close.setBackground(new Color(240, 250, 240));
    	construction.add(close, BorderLayout.SOUTH);
    }
    
    public class ButtonListener implements ActionListener
    {
    	public void actionPerformed(ActionEvent e)
    	{
    		if(e.getSource() == close)
    		{
    			//will close the page without closing the system
    			father.dispose();
    		}
    	}
    }

}



Commission
/**
 * Name: Commission.java
 * Function: This is the page set up to calculate commission on sales done by salesmen. This page is still under construction.
 */

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

class MyFrame extends JFrame
{
	MyFrame()
	{
		super("This is my application");
		add(new Commission(this));
	}
}

public class Commission extends JPanel {
	JButton close;
	JFrame father;
	
	Commission(JFrame father)
	{
		this.father = father;
	}
	
   public Commission()
   {
   		//panel to hold title
    	JPanel construction = new JPanel();
    	construction.setBackground(new Color(46, 139, 87));
    	construction.setPreferredSize(new Dimension(300,300));
    	add(construction);
    	
    	//title stating under construction
    	JLabel title = new JLabel("Under Construction");
    	title.setForeground(new Color(240, 250, 240));
    	Font font = new Font("Bradley Hand ITC", Font.PLAIN, 30);
    	title.setFont(font);
    	construction.add(title);
    	
    	//button used to close frame
    	close = new JButton("Close");
    	close.addActionListener(new ButtonListener());
    	close.setForeground(new Color(46, 139, 87));
    	close.setBackground(new Color(240, 250, 240));
    	construction.add(close, BorderLayout.SOUTH);
    	
    }
    
    public class ButtonListener implements ActionListener
    {
    	public void actionPerformed(ActionEvent e)
    	{
    		if(e.getSource() == close)
    		{
    		
    			//action to close the entire frame without closing the entire system	
    			father.dispose();
    		}
    	}
    }
}



That is as far as I have gotten. Again I appreciate all the help and it means more than you know... I have a question though. I am sure you saw that coming. Yesterday my Payroll and Commission page was working but today it isn't. When I hit the close button on these pages I am getting an error, A null pointer exception error I do believe. Again thanks for everything and I hope you enjoy my program so far. Would love some feedback on it if you have time.
Was This Post Helpful? 0
  • +
  • -

#27 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8014
  • View blog
  • Posts: 31,118
  • Joined: 06-March 08

Re: Changing the Color of My JPanel

Posted 09 May 2012 - 12:55 PM

Post the stack trace of your NullPointerException

View PostSnoBunny85, on 09 May 2012 - 03:03 PM, said:

Again, I am so sorry. I feel bad now.

Don't worry, you are not the worst :)

Happy coding :^:
Was This Post Helpful? 0
  • +
  • -

#28 SnoBunny85  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 87
  • Joined: 02-March 10

Re: Changing the Color of My JPanel

Posted 09 May 2012 - 12:59 PM

--------------------Configuration: <Default>--------------------
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Commission$ButtonListener.actionPerformed(Commission.java:61)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.window.dispatchEventImpl(window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Was This Post Helpful? 0
  • +
  • -

#29 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8014
  • View blog
  • Posts: 31,118
  • Joined: 06-March 08

Re: Changing the Color of My JPanel

Posted 09 May 2012 - 01:21 PM

Your Commission class has 2 constructors

One that receives the JFrame as parameter and does nothing else but saving who the father is
One that receives no parameter that does few things including installing the ButtonListener that will react to the close Button.

As the actionPerformed() is fired, it means that it is your second constructor that was called. This constructor does not receive the Frame to dispose() as parameter so your
father.dispose() will it a null father and generate that error. Probably here:

commission.getContentPane().add(new Commission());
Was This Post Helpful? 0
  • +
  • -

#30 SnoBunny85  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 87
  • Joined: 02-March 10

Re: Changing the Color of My JPanel

Posted 10 May 2012 - 09:22 AM

That makes sense but how exactly would you fix it. Would I need to get rid of one of my constructors or find a way to call the first one instead of the second one??
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3