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