A simple Java program that uses Swing and Java2D to help students understand the concept of Java interfaces.
The program is a JFrame
that contains shapes. Created shapes can be
dragged around the top panel using the left mouse button and can be
double clicked on. This program is meant to show students how an
interface (ClickableShape
) may be used to create new object types with
minimal refactoring.
Try creating a ClickableRectangle
class that extends the
ClickableShape
interface. Use the ClickableTriangle
class as a
reference.
The application also demonstrates the use of Swing, Java2D, and Java Core Reflection.
If the program is run, it should look similar to the following screenshot.
The program was developed in Eclipse. To work with the project in
Eclipse, use the import feature: File->Import->Existing Project
The main
method for the application is in the Main
class.
The project is licensed under the terms of the GPL3 license.