use a Canvas or JPanel?
843789Aug 3 2010 — edited Aug 4 2010I am not asking about the basic differences between a Canvas and a JPanel. Rather, based on the following criteria, which is the better choice:
(-) I will be "doodling": just drawing strokes in a Component.
(-) The strokes will be drawn slowly and asynchronously, (so I will have to deal with threading).
(-) I have no need for 3-d imaging.
(-) I don't need to respond to user events.
(-) That JPanel is also a container should have no benefit. I am just drawing shapes.
The decision about whether to use a heavy-weight (Canvas) vs. a light-weight (JPanel) would seem to have important implications?
As of now, I'd choose the Canvas because the Graphics, Graphics2D, Canvas are all in the same package. And Canvas seems explicitly designed to support drawing, and only drawing. Though, using a light-weight component might be the better choice. Isn't that why Swing was developed? Before proceeding, I'd just like to choose the better Component. Any advice welcome.