当前页面:
在线文档首页 >
JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档
Class java.awt.Canvas - JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档
All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.Canvas
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
- public class Canvas
- extends Component
A
Canvas
component represents a blank rectangular
area of the screen onto which the application can draw or from
which the application can trap input events from the user.
An application must subclass the Canvas
class in
order to get useful functionality such as creating a custom
component. The paint
method must be overridden
in order to perform custom graphics on the canvas.
-
Canvas()
-
Constructs a new Canvas.
-
addNotify()
- Creates the peer of the canvas.
-
paint(Graphics)
- This method is called to repaint this canvas.
Canvas
public Canvas()
- Constructs a new Canvas.
addNotify
public void addNotify()
- Creates the peer of the canvas. This peer allows you to change the
user interface of the canvas without changing its functionality.
- Overrides:
- addNotify in class Component
- See Also:
- createCanvas, getToolkit
paint
public void paint(Graphics g)
- This method is called to repaint this canvas. Most applications
that subclass
Canvas
should override this method in
order to perform some useful operation.
The paint
method provided by Canvas
redraws this canvas's rectangle in the background color.
The graphics context's origin (0, 0) is the top-left corner
of this canvas. Its clipping region is the area of the context.
- Parameters:
- g - the graphics context.
- Overrides:
- paint in class Component
- See Also:
- Graphics
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.