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.
| Modifier and Type | Class and Description |
|---|---|
| protected class | Canvas.
This class implements accessibility support for the
|
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static int | |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.1 for interoperability.
|
| Access | Constructor and Description |
|---|---|
| public | |
| public | Canvas(GraphicsConfiguration
a reference to a GraphicsConfiguration object or null config)Constructs a new Canvas given a GraphicsConfiguration object. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv String | constructComponentName()
Overrides java. Construct a name for this component. |
| public void | createBufferStrategy(int
number of buffers to create, including the front buffer numBuffers)Overrides java. Creates a new strategy for multi-buffering on this component. |
| public void | createBufferStrategy(int
number of buffers to create numBuffers, BufferCapabilities the required capabilities for creating the buffer strategy;
cannot be caps)nullOverrides java. Creates a new strategy for multi-buffering on this component with the required buffer capabilities. |
| public AccessibleContext | Returns: an AccessibleAWTCanvas that serves as the AccessibleContext of this CanvasOverrides java. Implements javax. Gets the AccessibleContext associated with this Canvas. |
| public BufferStrategy | Returns: the buffer strategy used by this componentOverrides java. Returns the |
| public void | paint(Graphics
the specified Graphics context g)Overrides java. Paints this canvas. |
| pack-priv boolean | |
| pack-priv void | |
| public void | update(Graphics
the specified Graphics context g)Overrides java. Updates this canvas. |
| base | back to summary |
|---|---|
| private static final String base | |
| nameCounter | back to summary |
|---|---|
| private static int nameCounter | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Use serialVersionUID from JDK 1.1 for interoperability. | |
| Canvas | back to summary |
|---|---|
| public Canvas() Constructs a new Canvas. | |
| Canvas | back to summary |
|---|---|
| public Canvas(GraphicsConfiguration config) Constructs a new Canvas given a GraphicsConfiguration object. If null is passed, then the default GraphicsConfiguration will be used.
| |
| addNotify | back to summary |
|---|---|
| public void addNotify() Overrides java. Creates the peer of the canvas. This peer allows you to change the user interface of the canvas without changing its functionality.
| |
| constructComponentName | back to summary |
|---|---|
| pack-priv String constructComponentName() Overrides java. Construct a name for this component. Called by getName() when the name is null. | |
| createBufferStrategy | back to summary |
|---|---|
| public void createBufferStrategy(int numBuffers) Overrides java. Creates a new strategy for multi-buffering on this component.
Multi-buffering is useful for rendering performance. This method
attempts to create the best strategy available with the number of
buffers supplied. It will always create a Each time this method is called, the existing buffer strategy for this component is discarded.
| |
| createBufferStrategy | back to summary |
|---|---|
| public void createBufferStrategy(int numBuffers, BufferCapabilities caps) throws AWTException Overrides java. Creates a new strategy for multi-buffering on this component with the required buffer capabilities. This is useful, for example, if only accelerated memory or page flipping is desired (as specified by the buffer capabilities). Each time this method is called, the existing buffer strategy for this component is discarded.
| |
| getAccessibleContext | back to summary |
|---|---|
| public AccessibleContext getAccessibleContext() Overrides java. Implements javax. Gets the AccessibleContext associated with this Canvas. For canvases, the AccessibleContext takes the form of an AccessibleAWTCanvas. A new AccessibleAWTCanvas instance is created if necessary.
| |
| getBufferStrategy | back to summary |
|---|---|
| public BufferStrategy getBufferStrategy() Overrides java. Returns the
| |
| paint | back to summary |
|---|---|
| public void paint(Graphics g) Overrides java. Paints this canvas.
Most applications that subclass
| |
| postsOldMouseEvents | back to summary |
|---|---|
| pack-priv boolean postsOldMouseEvents() Overrides java. | |
| setGraphicsConfiguration | back to summary |
|---|---|
| pack-priv void setGraphicsConfiguration(GraphicsConfiguration gc) Overrides java.
| |
| update | back to summary |
|---|---|
| public void update(Graphics g) Overrides java. Updates this canvas.
This method is called in response to a call to Note applications that override this method should either call super.update(g) or incorporate the functionality described above into their own code.
| |
Canvas class. It provides an implementation of the
Java Accessibility API appropriate to canvas user-interface elements.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides java. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public AccessibleRole | Returns: an instance of AccessibleRole describing the role of the objectOverrides java. Get the role of this object. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. Use serialVersionUID from JDK 1.3 for interoperability. | |
| AccessibleAWTCanvas | back to summary |
|---|---|
| protected AccessibleAWTCanvas() Constructs an | |
| getAccessibleRole | back to summary |
|---|---|
| public AccessibleRole getAccessibleRole() Overrides java. Get the role of this object.
| |