5.5 CanvasA Canvas is a class just waiting to be subclassed. Through Canvas, you can create additional AWT objects that are not provided by the base classes. Canvas is also useful as a drawing area, particularly when additional components are on the screen. It is tempting to draw directly onto a Container, but this often isn't a good idea. Anything you draw might disappear underneath the components you add to the container. When you are drawing on a container, you are essentially drawing on the background. The container's layout manager doesn't know anything about what you have drawn and won't arrange components with your artwork in mind. To be safe, do your drawing onto a Canvas and place that Canvas in a Container. Canvas MethodsConstructors
Canvas EventsThe Canvas peer passes all events to you, which is why it's well suited to creating your own components. |
|