Canvas.java revision 3261
3261N/A * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A <code>Canvas</code> component represents a blank rectangular 0N/A * area of the screen onto which the application can draw or from 0N/A * which the application can trap input events from the user. 0N/A * An application must subclass the <code>Canvas</code> class in 0N/A * order to get useful functionality such as creating a custom 0N/A * component. The <code>paint</code> method must be overridden 0N/A * in order to perform custom graphics on the canvas. 0N/A * @author Sami Shaio 0N/A * JDK 1.1 serialVersionUID 0N/A * Constructs a new Canvas. 0N/A * Constructs a new Canvas given a GraphicsConfiguration object. 0N/A * @param config a reference to a GraphicsConfiguration object. 0N/A * @see GraphicsConfiguration 0N/A * Construct a name for this component. Called by getName() when the 0N/A * Creates the peer of the canvas. This peer allows you to change the 0N/A * user interface of the canvas without changing its functionality. 0N/A * @see java.awt.Toolkit#createCanvas(java.awt.Canvas) 0N/A * @see java.awt.Component#getToolkit() 0N/A * Paints this canvas. 0N/A * Most applications that subclass <code>Canvas</code> should 0N/A * override this method in order to perform some useful operation 0N/A * (typically, custom painting of the canvas). 0N/A * The default operation is simply to clear the canvas. 0N/A * Applications that override this method need not call 0N/A * @param g the specified Graphics context 0N/A * @see #update(Graphics) 0N/A * @see Component#paint(Graphics) 0N/A * Updates this canvas. 0N/A * This method is called in response to a call to <code>repaint</code>. 0N/A * The canvas is first cleared by filling it with the background 0N/A * color, and then completely redrawn by calling this canvas's 0N/A * <code>paint</code> method. 0N/A * Note: applications that override this method should either call 0N/A * super.update(g) or incorporate the functionality described 0N/A * above into their own code. 0N/A * @param g the specified Graphics context 0N/A * @see #paint(Graphics) 0N/A * @see Component#update(Graphics) 0N/A * Creates a new strategy for multi-buffering on this component. 0N/A * Multi-buffering is useful for rendering performance. This method 0N/A * attempts to create the best strategy available with the number of 0N/A * buffers supplied. It will always create a <code>BufferStrategy</code> 0N/A * with that number of buffers. 0N/A * A page-flipping strategy is attempted first, then a blitting strategy 0N/A * using accelerated buffers. Finally, an unaccelerated blitting 0N/A * Each time this method is called, 0N/A * the existing buffer strategy for this component is discarded. 0N/A * @param numBuffers number of buffers to create, including the front buffer 0N/A * @exception IllegalArgumentException if numBuffers is less than 1. 0N/A * @exception IllegalStateException if the component is not displayable 0N/A * @see #isDisplayable 0N/A * @see #getBufferStrategy 0N/A * Creates a new strategy for multi-buffering on this component with the 0N/A * required buffer capabilities. This is useful, for example, if only 0N/A * accelerated memory or page flipping is desired (as specified by the 0N/A * buffer capabilities). 0N/A * Each time this method 0N/A * is called, the existing buffer strategy for this component is discarded. 0N/A * @param numBuffers number of buffers to create 0N/A * @param caps the required capabilities for creating the buffer strategy; 0N/A * cannot be <code>null</code> 0N/A * @exception AWTException if the capabilities supplied could not be 0N/A * supported or met; this may happen, for example, if there is not enough 0N/A * accelerated memory currently available, or if page flipping is specified 0N/A * @exception IllegalArgumentException if numBuffers is less than 1, or if 0N/A * caps is <code>null</code> 0N/A * @see #getBufferStrategy 0N/A * Returns the <code>BufferStrategy</code> used by this component. This 0N/A * method will return null if a <code>BufferStrategy</code> has not yet 0N/A * been created or has been disposed. 0N/A * @return the buffer strategy used by this component 0N/A * @see #createBufferStrategy 0N/A * --- Accessibility Support --- 0N/A * Gets the AccessibleContext associated with this Canvas. 0N/A * For canvases, the AccessibleContext takes the form of an 0N/A * AccessibleAWTCanvas. 0N/A * A new AccessibleAWTCanvas instance is created if necessary. 0N/A * @return an AccessibleAWTCanvas that serves as the 0N/A * AccessibleContext of this Canvas 0N/A * This class implements accessibility support for the 0N/A * <code>Canvas</code> class. It provides an implementation of the 0N/A * Java Accessibility API appropriate to canvas user-interface elements. 0N/A * Get the role of this object. 0N/A * @return an instance of AccessibleRole describing the role of the 0N/A * @see AccessibleRole 0N/A }
// inner class AccessibleAWTCanvas