Programming Resources
For Fun and Learning
Charles Cusack
Computer Science
Hope College
main

Python
C++

JAVA


PHP
SQL
Alice

AnimatedDrawing


Description

Run it
Download jar file (Right click)

Animator.java
BasicString.java
DrawableObject.java
DrawingPanel.java
DrawingStuff.java
MovingDrawableObject.java
Oval.java
Rectangle.java
Shape.java
Triangle.java

Description
AnimatedDrawing is a simple application that has a window with several objects on it. There is a single "selected object" which can be moved using the arrow keys. Other keys that do something are:
  • n Go to the next shape.
  • t Move the selected object to the top.
  • b Move the selected object to the bottom.
The purpose of these classes are
  • give a good example of when using inheritance is good
  • give an example of how to draw simple shapes
  • show how to use a few swing elements, including JPanel, JButton, JFrame.
  • show how do a a little but of event handling in Java. Specifically, mouse and keyboard events.
The jar file contains the source files and the BlueJ project files, so you can easily work with the project if you use BlueJ.

This is a solution to Inheritance Excerise with the added feature of animation!