Lecture slides
What you learned in CSC 121
The Course class
The Student class
The Information Manager class
zip file for the project
Chapter 7: Graphical User Interfaces
ClickCounter1.java
: Simple
GUI
using JFrame, JButton, and JLabel, and no layout manager
ClickHandler.java
: Basic event handler for handling ActionEvents
ClickCounter2.java
: GUI with (
external
) event handling
ClickCounter3.java
: GUI with (
internal
) event handling
TipCalculator.java
TipCalculator1.java
: Supports Action Events on JTextFields and JButtons
TipCalculator2.java
: Also supports menus.
The user interface
Associating icons with Swing components
Chapter 8: Exception Handling and Assertions
TipCalculator
with exceptions caught
TipCalculator
with exceptions thrown and caught
TipCalculator
with user defined exceptions
BadBillException
,
BadTipException
TipCalculator
: checked exception example
Assertions
Using CRC cards,
one link
another link
Chapter 12: File I/O
The classes File, JFileChooser etc..
Filtering certain files
A file viewer written in Java
Reading and writing files
Low level byte access
Writing a byte array to a file
,
low level view of the file
What can a byte hold ?
Reading a byte array from a file
Reading and writing primitive data types
Writing int, float, double, etc. to a file
Reading int, float, double etc from a file
Reading and writing text files
Using PrintWriter objects
Comparing binary files to text files
what does the binary file look like ?
what does the text file look like ?
Using BufferedReader objects
Wu's FileManager class
Reading and writing Java objects.
Writing objects to an ObjectOutputStream
. Object written must implement the java.io.Serializable interface.
Reading objects from an ObjectInputStream
. Object read must implement the java.io.Serializable interface.
Chapter 13: Inheritance and Polymorphism
The classes
Student
,
UnderGraduateStudent
, and
GraduateStudent
The classes
Quadrilateral
,
Parallelogram
, and
Rectangle
,
Test
Keywords:
abstract
and
final
interfaces versus abstract classes
super: reference to base class
super(zero or more parameters): reference to appropriate constructor in base class
this (zero or more parameters): reference to appropriate constructor in referencing class
protected: visibility limited to defining class and classes that are derived from it
Chapter 14: More GUI components
Handling mouse events
Handling mouse motion events
Using Layout Managers
Some other Swing components
JCheckBox.
Example 1
and
Example 2
. Generates
ItemEvent
that are sent to registered
ItemListener
objects.
JRadioButton
.
JComboBox
JList
JSlider
. Generates
ChangeEvent
that are sent to registered
ChangeListener
objects.
Chapter 11:
Sorting and Searching
Searching:
Search routines
Linear search
Binary search
Comparing
linear and logarithmic complexity
Sorting:
Sorting routines
Selection sort
Bubble sort
Heap sort
Writing generic, reusable code example
generic bubble sort
Code for testing:
TestGenericSort
, and
Pumpkin
Chapter 15: Recursion
String permutation
Concurrent Programming
Thread Example
Thread Test