/java-interface-example

A Java program that uses Swing and Java2D to help students understand the concept of Java interfaces

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

java-interface-example

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.

Screenshots

If the program is run, it should look similar to the following screenshot.

Shapes

Setup

The program was developed in Eclipse. To work with the project in Eclipse, use the import feature: File->Import->Existing Project

Usage

The main method for the application is in the Main class.

License

The project is licensed under the terms of the GPL3 license.