Should the DShapes be subclasses of JComponent?
No. The canvas is the component, it gets paintComponent() and runs things from there -- sortof like the Dots example.
|
Should the DShapes be subclasses of JComponent?
No. The canvas is the component, it gets paintComponent() and runs things from there -- sortof like the Dots example.
The handout says the shapes should draw themselves, but how can that work since they are not components?
A better phrasing might be "the shapes cause themselves to be drawn".
Should newly created shapes be selected?
That's a good idea, but it's not required.
Should the knobs draw on top of everything?
The simplest scheme is that knobs draw in the same layer as the shape itself, covered by the same things as the shape.
I'm doing the smart-repaint right, but the "old" area of my shapes is not being erased to the canvas background color.
Make sure you're calling super.paintComponent(g) in the canvas paintComponent() (see the dots example).
How is DShape.modelChanged() supposed to cause the shape to be redrawn if it doesn't have access to the Canvas or its Graphics object?
Try keeping a pointer to the Canvas in each DShape
|