1 / 18

George Blank University Lecturer

George Blank University Lecturer. CS 602 Java and the Web. Object Oriented Software Development Using Java Chapter 8. Application Frameworks. Java has an extensive collection of application frameworks, collections of cooperating classes that can be used in developing applications.

Download Presentation

George Blank University Lecturer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. George Blank University Lecturer

  2. CS 602Java and the Web Object Oriented Software Development Using Java Chapter 8

  3. Application Frameworks • Java has an extensive collection of application frameworks, collections of cooperating classes that can be used in developing applications. • Chapter 8 emphasizes three such frameworks—collections, input/output and GUIs using AWT and Swing.

  4. Expected knowledge • Students should not only understand and be able to use the classes described in the text, but must also develop skill in using Java documentation to go beyond the material in the text. • It is recommended that students become familiar withhttp://java.sun.com/reference/docs/index.html • Another good site: http://javadocs.org/

  5. Chapter notes • There is so much in this chapter that I hesitate to add more to the readings. • I do recommend that students make certain that they understand the topics described in the chapter summary.

  6. Abstract Collection Types • A bag or multiset is an unordered collection of elements that may include duplicates. A bag, in Java the Collection interface, is the least restrictive and most general form of collection. • A set is an unordered collection of elements without duplicates. • A list is an ordered collection of elements. • A map, dictionary or associative array is an unordered collection of key-value pairs.

  7. add(element) addAll(collection) clear() contains(element) containsAll(collection) isEmpty() iterator() remove(element) removeAll(collection) retainAll(collection) size() Methods of Interface Collection

  8. add(i,element) add(element) addAll(collection) addAll(i,collection) get(i) indexOf(element) lastIndexOf(element) containsAll(collection) listIterator() listIterator(i) remove(i) remove(element) removeAll(collection) set(i,element) subList(i,j) Methods of Interface List

  9. clear() containsKey(k) containsValue(v) entrySet() get(k) isEmpty() keySet() put(k,v) put(map) remove(k) removeAll(collection) size() values() k = key v = value Methods of Interface Map

  10. Types of Sets • A HashSet stores elements in a hash table. • A LinkedHashSet is an ordered hash table. • A TreeSetstoreselements in a balanced binary tree.

  11. Sets HashSet LinkedHashSet TreeSet1 Lists Array List Linked List Vector Maps HashMap IndentityHashMap LinkedHashMap TreeMap1 Hashtable 1sorted Concrete Collections

  12. Ordering • An order (technically a partial order) is a transitive binary relationship between two objects. Organized by some criteria, if a has a certain relationship with b and b has the same relationship with c, then a has that relationship with c. • A sorted collection is one that orders its elements by a particular relationship.

  13. Defining Orders on Objects • A class can define a natural order among its instances by implementing the comparable interface. • Arbitrary orders among different objects can be defined by comparators, or classes that by implement the comparator interface. • SortedSet and SortedMap are sorted abstract collections that inherit the functions of sets and maps respectively.

  14. Word Frequency example • The Class WordFrequency2 on pages 327-328 shows an example of using a sorted map sorted by their natural keys. It first orders the words in a piece of text and then counts the identical words to determine their frequency. Class WordFrequency4 on page 332 extends this to sort the result and display the words in frequency order.

  15. Java Graphical User Interfaces • Java has a GUI framework consisting of several categories of classes: • GUI Components (widgets) have a characteristic appearance (look) and behavior (feel). • Layout managers package components in windows. (see FlowLayout and BorderLayout) • Events and Event Listeners • Grapics and Imaging classes

  16. Abstract Windows Toolkit • The basic Java GUI toolkit is the Abstract Windows Toolkit (AWT) The Swing package is an extension of AWT to build high quality GUIs. • Review the hierarchy of awt at http://java.sun.com/j2se/1.5.0/docs/api/java/awt/package-tree.html to see the wde variety of classes available to build GUI applications. • The Java Class hierarchy is a good starting place to understand Java libraries: http://java.sun.com/j2se/1.5.0/docs/api/overview-tree.html

  17. Understanding Layouts • It is important to practice using the layouts such a flow layouts in order to understand how to present information attractively to the end user. Problem 8.5 in the text is a good exercise for this purpose.

  18. Bibliography • Jia, Xiaoping, Object Oriented Software Development Using Java. Addison Wesley, 2003 • http://java.sun.com/reference/docs/index.html • http://javadocs.org/

More Related