next up previous contents
Next: User Interaction & Mouse Up: GraphPanel Class Previous: GraphPanel Class

Graph Display and Animation

Drawing a Graph is simply a matter of telling the Graph to draw itself; however, animating motion is not so simple. The technique devised is called triple buffering. When a vertex is selected and the mouse begins to move, a background image is drawn using the fixed components of the graph. The paint() method copies the background image onto a drawing image and adds on the portions of the graph which are moving. The paint() method then copies the completed drawing image onto the screen. The fullpaint() method is used when the graph is otherwise modified.

Note: Although this technique must be used elsewhere, I have never seen it discussed in any text nor taught in class. I thought of this while studying double buffering, and suggested it in my Java class. By the time the next class met, Robert Simms [10] had incorporated the idea in his project and was estatic with the results. He was moving fixed sized objects and used triple buffering with a clipping rectangle to speed up the animation. I think clipping would help here too and will try it when I have time.



Kelly Waters
Mon Oct 27 18:18:15 EST 1997