Code Examples

Thursday 11-Jan
Rover.java A class that implements Critter for Project 1
Thursday 18-Jan
FirstGUI.java Use a JFrame
PlayOneSongMain.java  Plays one song hard coded in new URL
Dancing_Queen.au (converted from midi)
Inverse Universe.au  (converted from mp3)
ShowListInGUI.java  A JList contains a model MyList<E> extends ArrayList<E>
Thursday 18-Jan
SomeEvents.java  ActionListeners listen to a button click and JTextfield Enter Pressed, show sqrt of input
ShowEventsWithTimer.java A modified version that displays 1, 2, 3, ... in the JTextField every second
Thursday 25-Jan (after quiz 1)
OneAccountFrame.java Answer to Section Exercise now with a Menu and changing layout
songfiles.zip A folder with different song formats including mp3
GetMP3_Metadata.java A java program that gets a list of song files and prints mp3 properties such as duration in microseconds
Tuesday 30-Jan
Here is the GUI prototype from whiteboard 25-Jan  gui_prototype_jukebox.JPG
Here is a JFrame that is almost done that was posted Friday night gui.GIF
Eclipse project in mp3player.zip has two classes to play mp3s in a separate thread
Section on 31-Jan or 1-Feb
WordSearcher.java  Shows all words containing the text in a text field. Needs words.txt
words.txt  A dictionary of over 81,000 words, one word per line, all lower case
Thursday 8-Feb
LayoutControllerFrame.java  Composition over Inheritance
LendableHierarchy5.zip  With a HashMap of three Lendable types
Thursday 22-Feb
BankAccount.java  A serialized object to be read and written over the wire
AccountServer.java  Run this first to wait for AccountClient.java to run
AccountClient.java  User gives money to the server by writing a double and a BankAccount and reading back the BankAccount after "money is taken"
Tuesday 27-Feb through Thursday 1-March (with section code)
Added after class Observer.zip  An Eclipse Archive File that has three examples of Observer
Text and Oval view of changing colors in one JFrame
Text and Button view of tow changing integers with a 2D array of buttons
Swap Text and Oval view of changing colors with JMenuItems (same four files demoed 1-March and likned under 1-March)
Thursday 1-March
Controller.java Now has a JMenu for two views
Model.java  An observable that changes colors randomly with a changeColor message
TextViewOfColor.java  A JPanel that shows text in the currentColor of the model

OvalViewOfColor.java A JPanel that paints an Oval in the currentColor of the model

JMenuItemDemoComposite.java JMenuItem is a Composite,  JTextField a leaf

Tuesday 5-March: Example of Decorator in use
GZIP.java Reads plain text and write compressed file in GZIP format
UNGZIP.java Reads a  compressed file in GZIP format an uncompresses it back to plain text
iliad10.txt The Iliad by Homer
Tuesday 27-March: Drawing a Car
MainDrawOnPanel.java 
DrawingPanel.java
Tuesday 27-March: Drawing Polygons and detecting which one was clicked
MainDetectPolygon.java
PolygonPanel.java

Quiz 6

4- and 5-April Section: Flyweight
Fylweight.zip  LetterGraphics with JPanel with Many Letters and animated GAME OVER
Thursday 5-April: An animation with sound
AnimationGrowingImage.zip
Thursday 5-April: Comparators follow the open-closed principle
ComparatorTest.java
BankAccount.java
Tuesday 10-April: RunEmployeeTableFrame.java

Quiz 7

18-April: Splashscreen.java  A Simple Splashscreen that disappears after 3 seconds
18-April: CommandLogger.java  Write and a list of command objects to a disk, read the list and execute the commands
18-April: CommandExerciseLibraryUndo.doc Class handout of UML for a Command Pattern example (undo/redo). Tasks at end with both the undo and redo listeners
LibraryCommandPattern.zip Code to demonstrate adding undo and redo to a small library system