public MyLibraryManager_Sort() {	
		
			sortIndex=new int [MyLibraryManager_Library.data.size()/8];
			
			p = new JPanel();		//creates new panel with drop-down lists and buttons added 
			p.setLayout(new FlowLayout());
			sortLabel.setFont(new Font("Century Gothic",Font.BOLD, 14));
			
			OK.setFont(new Font("Century Gothic",Font.BOLD, 12));
			CANCEL.setFont(new Font("Century Gothic",Font.BOLD, 12));
				
			fieldList =  new JComboBox(fieldStrings);
			fieldList.setSelectedIndex(0);
			fieldList.setFont(new Font("Century Gothic",Font.BOLD,12));
			
			Box box = Box.createHorizontalBox();
            box.add(Box.createHorizontalGlue());
            box.add(sortLabel); box.add(fieldList); //add the box containing elements to the panel 
                       
            Box box2 = Box.createHorizontalBox();
            box2.add(Box.createHorizontalGlue());
            box2.add(OK); box2.add(CANCEL);
            
			p.add(box);
			p.add(box2);
						
			OK.addActionListener(new ActionListener() {	//action performed when user clicks OK 
				public void actionPerformed(ActionEvent e) {
					int counter=0;
					String sortBy=(String)fieldList.getSelectedItem();	//get the field to be sorted and the order it is to be sorted in 
					sortIndexOrganizer=new int[sortIndex.length];	
					
					frame.setVisible(false);
					
					if (MyLibraryManager_Library.data.size()==1) {
						JOptionPane.showMessageDialog(frame,
			                    "There are no records to sort.",
			                    "Error Message",
			                    JOptionPane.ERROR_MESSAGE);
					}
					
					else {
						
						Vector dataToBeSorted=new Vector();	//stores all the data within the sort column 

						for (int i=0; i<7; i++) {
							if (sortBy.equals(fieldStrings[i])) sortColumn=i+1;	//get the column number in order to find the appropriate sort data 								
						}
						
						for (int i=sortColumn; i<MyLibraryManager_Library.data.size(); i++) {
							dataToBeSorted.addElement(MyLibraryManager_Library.data.elementAt(i));	//adds all elements within the column to the vector
							sortIndex[counter]=i;
							i=i+7;
							counter++; 
						}
							
						for (int i=0; i<sortIndex.length; i++) {
							sortIndexOrganizer[i]=sortIndex[i];		//adds the sort indices to an organizer to process in sort 
						}
						
						for (int i=0; i<recordAt.length; i++) {
							recordAt[i]="";		//initialize the string display of sort results
						}
						
						for (int i=0; i<sortIndex.length;i++) {
							for (int j=sortIndex[i]/8*8; j<sortIndex[i]/8*8+8; j++) {
								recordAt[sortIndex[i]]=recordAt[sortIndex[i]]+MyLibraryManager_Library.data.elementAt(j)+"|";	//add element from
								//original sort indices into string display of results
							}							
						}
						sortFunction(dataToBeSorted, 0, dataToBeSorted.size()-1);	//initiate sort function of elements within the column
						
						System.out.println("Sort Results: "+sortBy);
						System.out.println("Printed on console in order to view full sort results list");
						System.out.println("");
						System.out.println("Unique Key|Book Title|Author Name|Year Published|Page Numbers|Publisher|Category|Book Rating");
						System.out.println("");
						
						for (int i=0; i<sortIndexOrganizer.length; i++) {
							sortResults.add(recordAt[sortIndexOrganizer[i]]);		//add the records that have the elements of the sorted sort indices
							//into a vector that will be displayed on the results window
							System.out.println(recordAt[sortIndexOrganizer[i]]);
						}
						System.out.println("_______");
						sortResultsWindow(sortBy);			//initiate GUI window showing results	
					}
				}
			});
			
			CANCEL.addActionListener(new ActionListener(){	//closes window if user presses cancel 
				public void actionPerformed(ActionEvent e){
					frame.setVisible(false);
				}
			});
				
			frame = new JFrame("Sort Book Entries");	//spawn frame and let it be visible 
			frame.setResizable(false);
			frame.add(p);
			frame.setSize(350,100);
			frame.setVisible(true);
	}