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

Python
C++

JAVA


PHP
SQL
Alice

DrawingExample


Description

Run it
Download jar file (Right click)

BasicShape.java
BasicString.java
DrawingExample.java
DrawingPanel.java
GraphicalObject.java
Oval.java
Rectangle.java
SizedObject.java

Description
DrawingExample 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.