Drawing lines and shapes
The applet below is a DrawSelector. Select the type of shape
you want to draw from the pulldown list below.
Press the "Go" button to start and the "Stop" button to stop.
DrawSelector
So this applet shows what sort of graphics can be done with Java
and how fast those operations are.
There is certainly room for improvement.
For example, the drawing surface used should really have been a
subclass of a Java Canvas, and the buttons should be
greyed out at the right times, but on the whole this does the
job it was meant to do. Later on, more consideration will be given to user interfaces.
In the words of a sagging grey-haired well known sports
personality (over there), How do they do that?
- DrawSelector. contains some
standard user interface widgets that control a DrawSelectorCanvas
- DrawSelectorCanvas. The
animated drawing surface that draws the lines. The animated
behaviour is inherited from ThreadedCanvas.
- ThreadedCanvas. The real workhorse
This manages the offscreen bitmap needed for animated behaviour.