/**for A3: public void mouseClicked(MouseEvent event) { //note the in your gui the only clickable event is a //button so you can safely say: JButton button = (JButton) event.getComponent(); //now the button is either one of the letter on the grid OR //the "enter word" button. How do we determine which letter on the grid? // easy! remember the "visual" array in tic-tac-toe? //so, in game GUI, we store the JButtons in a 2d array as we create them. // and here just we search for the clicked one to figure out row/colum. //Also, we store a reference to "enter word" button as well. So: if (button=enterButton){//it's the enterword button //process this buttons }else{ //search the 2d array of buttons, to figure out row/column //process the button } Note: you shouldn't implement all the stuff if-else here. Instead you should call proper methods from other classes. */ //ok back to sort //let's add a timer to our sort methos //class Date gives you a Date object with current time. It has a getTime method //which returns a number in miliseconds. So, if you take the //differnce of to getTime() you get the time passed in miliseconds Sort.selectionSort(new int[]{8,54,3,2,3,4,57,5,78,5,3,3,5,1,686,43,42,46}); Sort.insertionSort(new int[]{8,54,3,2,3,4,57,5,78,5,3,3,5,1,686,43,42,46,3,2,3}); Sort.insertionSort(new int[]{8,54,3,2,3,4,57,5,78,5,3,3,5,1,686,43,42,46,3,2, 34,3,2,5,7,4,68,9,65,3,2,44,32,7,84,32,87,65,24,24,78,12,7,3,4,85}); Sort.selectionSort(new int[] {9,8,7,6,5,4,3,2,1}); Sort.insertionSort(new int[] {1,2,3,4,5,6,7,8,9}); Sort.insertionSort(new int[] {6,4,7,5,9,1,3,2,8}); Sort.insertionSort(new int[] {6,4,7,5,9,1,3,2,8,54,3,2,56,3,1,9}); int[] array = new int[10000]; import java.util.Random; Random r = new Random(); for (int i = 0; i < 10000; i++) { array[i] = r.nextInt(); } Sort.selectionSort(array) Sort.insertionSort(array) //ok let's write a TimeSort utility class to measure sorting times //for random/sorted/reverse-sorted arrays of size N. TimeSort.selectionSort(100) TimeSort.insertionSort(100) TimeSort.bubbleSort2(100) TimeSort.selectionSort(1000) TimeSort.insertionSort(1000) TimeSort.bubbleSort2(1000) TimeSort.selectionSort(10000) TimeSort.insertionSort(10000) TimeSort.bubbleSort2(10000) //exercise try arrays of various sizes 100, 1000, 10k, 25k, 50k, 75k, 100K, 250K, 500K, 1M //and draw a graph time/size for each technique and array content (random, sorted, reversed). //what do you see? why do comps and swaps numbers somethime become negative? how do you fix this?