CS102 Code Examples

These are some of the longer code examples from lecture.
Picture.java
A subclass of Component for displaying an image from a file.

FreeFormLayout.java
A layout manager that basically does nothing.

Client/Server Framework: The first two files provide a framework for creating client/server applications that is slightly more general than the one given in class. Adapters are provided for both the ClientBehavior and ServerBehavior interfaces. All ClientBehavior and ServerBehavior objects are responsible for calling closeSocket when they are finished. The second two files provide an example.

ReflectionExample.java
includes some demonstrations of using reflection to examine classes, instantiate objects, and call methods on objects.