Source code for Graphics Project
Project files:
The project contains the following files, which can be viewed as highlighted source code.
- Package coordinatechanges
- File DemoFrame.java: This class implements a window which contains a DemoPanel. The window has a menu bar and a status bar. Click here to run it.
- File DemoPanel.java: This is a simple panel (part of a window) which dispays some mathematical graphics. It converts objects from math to screen coordinates before dispaying them using the TransformManager class.
- File TransformChangedListener.java: This is an interface that allows a TransformManager to notify a panel when the coordinate transformation has changed.
- File TransformManager.java: Manages a coordinate change from math-coordinates to screen coordinates. The class guarantees that a certain rectangle will be displayed.
- Package drawsomething
- File Complex.java: A complex number class.
- File DrawSomething.java: Modifies the DrawingDemo class to draw a logarithmic spiral using the Complex number class.
- Package justdrawing
- Package layers
- File CircleLayer.java: This is a small modification of CircleLayer, which handles squares instead of circles.
- File LayerDemoFrame.java: An executable program demonstrating the use of Layers. The program creates a window with two layers, which enable the user to create disks and squares and move them around.
- File LayeredPanel.java.
- File Layer.java: An interface representing a "Layer" of graphics.
- File SquareLayer.java: An implementation of the Layer interface. The code was mostly taken out of InteractionDemo.java.
- Package mouseinteraction
- Package simplermouseinteraction
Zip file:
These files can be downloaded all at once using the zip file Graphics.zip.
Documentation:
You can also view the JavaDoc generated documentation for the project.
Return to the java tutorial