Lecture34 - Java Programming, 3e Concepts and Techniques...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Java Programming, 3e Concepts and Techniques Chapter 7 Swing Interfaces with Sorting and Searching (V) ICTN 2730 Lecture 34 04/14/2008 2 Assignments Read chapter 7 and lecture notes. The week 14 bonus assignment is due Wednesday. Please consider doing it if you would like to improve your final grade. Please start early so you have time to go over the concepts from Chapters 1-7. 3 The actionPerformed() Event Use getActionCommand() to retrieve the String assigned to a component that can have multiple states Use getSource() to retrieve the clicked object If the combo box was clicked, the index number is compared in a switch statement to specify the sort If Insert was clicked, enlargeArray() creates a new array to accommodate the new movie data New data is sent to each array, which is then sorted If Search was clicked, the field name and array are sent to the search() method 4 Coding the enlargeArray() Method Accepts an array and returns a new array that is one element longer The actionPerformed() method inserts the new data at the end of the new array 5 Sorting an Array Bubblesort When a pair of elements is examined, the interchanged element moves to the top of the array Selection sort The array is searched for its lowest-value element, which is then positioned at the beginning of the array The process is repeated for each element, placing the elements in the next unsorted location Insertion sort Creates a new array and inserts the values in order...
View Full Document

Page1 / 24

Lecture34 - Java Programming, 3e Concepts and Techniques...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online