Wednesday, June 29, 2011

Drawable Canvas

The component itself is a transparent canvas (background alpha = 0), which means that you can put it on top of anything you like in order to be able to draw anywhere.
On the mouse down event I add a mouse move listener which adds points to an array, and I remove the listener on the mouse up event. These arrays are the lines.
In the updateDisplayList method I loop through all the held arrays and draw them onto the canvas.


source

No comments:

Freelance