public Lab9Frame()
    {
        /* create int[]; create new instance of MyPanel sortPanel with myList attribute */
        myList = buildList();
        sortPanel = new MyPanel(myList);
        
        /* thread, flags, sleep duration */
        sortThread = new Thread(new Runnable(){
            public void run()
            {
                return;
            }
        });
        sortThreadIsActive = (sortThread.isAlive()) && (!(sortThread.isInterrupted()));
        stopFlag = true;
        pauseFlag = false;
        msSleepDuration = 0;
         
        /* SORT BUTTONS: radioButtonPanel 1 of 2 */
        insertionSortRadioButton = new JRadioButton("insertion sort", true);  /* default sort */
        quickSortRadioButton = new JRadioButton("quick sort", false);
        mergeSortRadioButton = new JRadioButton("merge sort", false);
        radioButtonGroup1 = new ButtonGroup();
        radioButtonGroup1.add(insertionSortRadioButton);
        radioButtonGroup1.add(quickSortRadioButton);
        radioButtonGroup1.add(mergeSortRadioButton);
        radioButtonPanel1 = new JPanel();
        radioButtonPanel1.add(insertionSortRadioButton);
        radioButtonPanel1.add(quickSortRadioButton);
        radioButtonPanel1.add(mergeSortRadioButton);
        
        /* CONTROL BUTTONS */
        startButton = new JButton("Start");
        resetButton = new JButton("Reset");
        stopButton = new JButton("Stop");
        pauseResumeButton = new JButton("Pause");
        buttonPanel1 = new JPanel();
        buttonPanel1.add(startButton);
        buttonPanel1.add(resetButton);
        buttonPanel1.add(stopButton);
        buttonPanel1.add(pauseResumeButton);
        
        /* SPEED BUTTONS: radioButtonPanel 2 of 2 */
        lowSpeedRadioButton = new JRadioButton("slow", false);
        normalSpeedRadioButton = new JRadioButton("normal", true);  /* default speed */
        highSpeedRadioButton = new JRadioButton("fast", false);
        radioButtonGroup2 = new ButtonGroup();
        radioButtonGroup2.add(lowSpeedRadioButton);
        radioButtonGroup2.add(normalSpeedRadioButton);
        radioButtonGroup2.add(highSpeedRadioButton);
        radioButtonPanel2 = new JPanel();
        radioButtonPanel2.add(lowSpeedRadioButton);
        radioButtonPanel2.add(normalSpeedRadioButton);
        radioButtonPanel2.add(highSpeedRadioButton);
        
        /* add panels to frame */
        this.getContentPane().setLayout(new FlowLayout());
        this.getContentPane().add(radioButtonPanel1);
        this.getContentPane().add(buttonPanel1);
        this.getContentPane().add(radioButtonPanel2);
        this.getContentPane().add(sortPanel);
        
        
        /* actionListener: startButton */
        startButton.addActionListener(new ActionListener(){
            /* checks whether sortThread is currently alive/running, or if has been set
             *   to false. if so, stopFlag is set to true.
             * calls removeAll() on sortPanel, shuffles myList, and repaints the
             *   randomized array onto sortPanel.
             * checks which sortButton has been selected; creates a new instance of
             *   Runnable Thread sortThread, calls the appropriate sort method within
             *   run(), then starts sortThread, afterward setting both stopFlag and
             *   pauseFlag to false */
            public void actionPerformed(ActionEvent e)
            {
                if(sortThreadIsActive || stopFlag == false)
                {
                    stopFlag = true;
                }
                
                sortPanel.removeAll();
                shuffleList(myList);
                repaint();                               
                
                /* SORT radio buttons */
                if(insertionSortRadioButton.isSelected())
                {
                    sortThread = new Thread(new Runnable(){
                        public void run()
                        {
                            insertionSort(myList);
                        }
                    });
                    
                    sortThread.start();
                    stopFlag = false;
                    pauseFlag = false;
                }
                
                else if(quickSortRadioButton.isSelected())
                {
                    sortThread = new Thread(new Runnable(){
                        public void run()
                        {
                            quickSort(myList, 0, myList.length - 1);
                        }
                    });
                    
                    sortThread.start();
                    stopFlag = false;
                    pauseFlag = false;
                }
                
                else  //if(mergeSortRadioButton.isSelected())
                {
                    sortThread = new Thread(new Runnable(){
                        public void run()
                        {
                            mergeSort(myList, 0, myList.length - 1);
                        }
                    });
                    
                    sortThread.start();
                    stopFlag = false;
                    pauseFlag = false;
                }
                                
            }//end actionPerformed()
            
        });//end startButton.addActionListener()
    
        /* actionListener: resetButton */
        resetButton.addActionListener(new ActionListener(){
            /* if resetButton has been selected, stopFlag is set to true, removeAll() is
             * called on sortPanel, and myList is randomized and then repainted onto
             * sortPanel */
            public void actionPerformed(ActionEvent e)
            {
                stopFlag = true;
                sortPanel.removeAll();
                shuffleList(myList);
                repaint();
                return;
            }
            
        });//end ResetButton.addActionListener()
    
        /* action listener: stopButton */
        stopButton.addActionListener(new ActionListener(){
            /* if stopButton has been selected, stopFlag is set to true */
            public void actionPerformed(ActionEvent e)
            {
                stopFlag = true;
                return;
            }
            
        });//end stopButton.addActionListener()
        
        /* action listener: stopButton */
        pauseResumeButton.addActionListener(new ActionListener(){
            /* if button has been selected and the button text says 'Pause,' pauseFlag
             * is set to true, and the button text is set to 'Resume.'
             * otherwise, if the button has been selected and the button text says 'Resume,'
             * pauseFlag is set to false, and the button text is set back to 'Pause.' */
            public void actionPerformed(ActionEvent e)
            {
                if(pauseResumeButton.getText() == "Pause")
                {
                    pauseResumeButton.setText("Resume");
                    pauseFlag = true;                    
                }
                
                else if(pauseResumeButton.getText() == "Resume")
                {
                    pauseResumeButton.setText("Pause");
                    pauseFlag = false;
                }

                return;
            }
            
        });//end pauseResumeButton.addActionListener()
        
    }//end default constructor