Download presentation
Presentation is loading. Please wait.
Published byChristian Watkins Modified over 9 years ago
1
Lecture 20 April 13, 2000
2
Review for Exam All Exercises and Sample Code from Lectures Object Based Programming Object Oriented Programming String and StringBuffer Operations Input/Output Exception Management Event Management GUI Design
3
Object Based Programming Reference Variables Objects hold instance fields and a reference to the class object. Class objects hold static fields, pointers to both static and instance methods, and a reference to the direct superclass object. Static, instance, local, and block-local variables. Public, private, and package access.
4
Object Oriented Programming Class Hierarchies –The “isa” relationship –Inheritance of methods and fields Exercise 5 –The super keyword –The super() method –Protected access Classes and Interfaces –Defining vs Declaring –Abstract Classes
5
String and StringBuffer Operations Exercises 6a and 6b Mutable or not Relative Efficiency Methods Available
6
Input/Output Class java.io.File Classes for reading/writing characters –BufferedReader, FileReader –BufferedWriter, FileWriter Classes for reading/writing bytes –FileInputStream –FileOutputStream Need to close output files.
7
Exception Management An Exception is … –The Exception class hierarchy. –Checked/Unchecked exceptions. The throw, throws, try, catch, and finally keywords. The @throws javadoc tag.
8
Event Management An Event is … –Event classes Event Listener Interfaces Event Adapter Classes Callback Methods Using anonymous classes to define listener objects.
9
GUI Design Classes –JFrame –JMenuBar –JMenu –JMenuItem
10
Action Listener Strategies Simple is Better … –Separate Listeners for Each Active Component Simple: Each actionPerformed() method deals only with events from a particular component. Complex: There can be a lot of actionPerformed() methods, each with its own (anonymous) class. –One Listener for All Events Simple: Only one actionPerformed() method. Complex: The actionPerformed() method must test each ActionEvent to see which component it came from, and then branch to the appropriate code for that component. [ ActionListener_ex.java ]ActionListener_ex.java
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.