jdk/src/share/classes/java/awt/Canvas.java
author anthony
Fri, 20 Feb 2009 17:34:16 +0300
changeset 2459 08f3416ff334
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
6804747: Ensure consistent graphicsConfig member across components hierarchy Reviewed-by: art, dcherepanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.image.BufferStrategy;
2459
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    28
import java.awt.peer.CanvasPeer;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.accessibility.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * A <code>Canvas</code> component represents a blank rectangular
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * area of the screen onto which the application can draw or from
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * which the application can trap input events from the user.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * An application must subclass the <code>Canvas</code> class in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * order to get useful functionality such as creating a custom
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * component. The <code>paint</code> method must be overridden
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * in order to perform custom graphics on the canvas.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @author      Sami Shaio
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * @since       JDK1.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
public class Canvas extends Component implements Accessible {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    private static final String base = "canvas";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private static int nameCounter = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * JDK 1.1 serialVersionUID
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     private static final long serialVersionUID = -2284879212465893870L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * Constructs a new Canvas.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    public Canvas() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * Constructs a new Canvas given a GraphicsConfiguration object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * @param config a reference to a GraphicsConfiguration object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @see GraphicsConfiguration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    public Canvas(GraphicsConfiguration config) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        this();
2459
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    69
        setGraphicsConfiguration(config);
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    70
    }
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    71
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    72
    @Override
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    73
    void setGraphicsConfiguration(GraphicsConfiguration gc) {
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    74
        CanvasPeer peer = (CanvasPeer)getPeer();
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    75
        if (peer != null) {
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    76
            gc = peer.getAppropriateGraphicsConfiguration(gc);
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    77
        }
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    78
08f3416ff334 6804747: Ensure consistent graphicsConfig member across components hierarchy
anthony
parents: 2
diff changeset
    79
        super.setGraphicsConfiguration(gc);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * Construct a name for this component.  Called by getName() when the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * name is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    String constructComponentName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        synchronized (Canvas.class) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            return base + nameCounter++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * Creates the peer of the canvas.  This peer allows you to change the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * user interface of the canvas without changing its functionality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * @see     java.awt.Toolkit#createCanvas(java.awt.Canvas)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @see     java.awt.Component#getToolkit()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public void addNotify() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        synchronized (getTreeLock()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            if (peer == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                peer = getToolkit().createCanvas(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            super.addNotify();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * Paints this canvas.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * Most applications that subclass <code>Canvas</code> should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * override this method in order to perform some useful operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * (typically, custom painting of the canvas).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * The default operation is simply to clear the canvas.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * Applications that override this method need not call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * super.paint(g).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @param      g   the specified Graphics context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @see        #update(Graphics)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * @see        Component#paint(Graphics)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    public void paint(Graphics g) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        g.clearRect(0, 0, width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Updates this canvas.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * This method is called in response to a call to <code>repaint</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * The canvas is first cleared by filling it with the background
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * color, and then completely redrawn by calling this canvas's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * <code>paint</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * Note: applications that override this method should either call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * super.update(g) or incorporate the functionality described
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * above into their own code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @param g the specified Graphics context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @see   #paint(Graphics)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @see   Component#update(Graphics)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    public void update(Graphics g) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        g.clearRect(0, 0, width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        paint(g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    boolean postsOldMouseEvents() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * Creates a new strategy for multi-buffering on this component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * Multi-buffering is useful for rendering performance.  This method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * attempts to create the best strategy available with the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * buffers supplied.  It will always create a <code>BufferStrategy</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * with that number of buffers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * A page-flipping strategy is attempted first, then a blitting strategy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * using accelerated buffers.  Finally, an unaccelerated blitting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * strategy is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Each time this method is called,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * the existing buffer strategy for this component is discarded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * @param numBuffers number of buffers to create, including the front buffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * @exception IllegalArgumentException if numBuffers is less than 1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * @exception IllegalStateException if the component is not displayable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * @see #isDisplayable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @see #getBufferStrategy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    public void createBufferStrategy(int numBuffers) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        super.createBufferStrategy(numBuffers);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Creates a new strategy for multi-buffering on this component with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * required buffer capabilities.  This is useful, for example, if only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * accelerated memory or page flipping is desired (as specified by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * buffer capabilities).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * Each time this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * is called, the existing buffer strategy for this component is discarded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @param numBuffers number of buffers to create
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @param caps the required capabilities for creating the buffer strategy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * cannot be <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @exception AWTException if the capabilities supplied could not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * supported or met; this may happen, for example, if there is not enough
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * accelerated memory currently available, or if page flipping is specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * but not possible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @exception IllegalArgumentException if numBuffers is less than 1, or if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * caps is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @see #getBufferStrategy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    public void createBufferStrategy(int numBuffers,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        BufferCapabilities caps) throws AWTException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        super.createBufferStrategy(numBuffers, caps);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * Returns the <code>BufferStrategy</code> used by this component.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * method will return null if a <code>BufferStrategy</code> has not yet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * been created or has been disposed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * @return the buffer strategy used by this component
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * @see #createBufferStrategy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    public BufferStrategy getBufferStrategy() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        return super.getBufferStrategy();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * --- Accessibility Support ---
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * Gets the AccessibleContext associated with this Canvas.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * For canvases, the AccessibleContext takes the form of an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * AccessibleAWTCanvas.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * A new AccessibleAWTCanvas instance is created if necessary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @return an AccessibleAWTCanvas that serves as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *         AccessibleContext of this Canvas
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    public AccessibleContext getAccessibleContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        if (accessibleContext == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            accessibleContext = new AccessibleAWTCanvas();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        return accessibleContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * This class implements accessibility support for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * <code>Canvas</code> class.  It provides an implementation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * Java Accessibility API appropriate to canvas user-interface elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    protected class AccessibleAWTCanvas extends AccessibleAWTComponent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        private static final long serialVersionUID = -6325592262103146699L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
         * Get the role of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
         * @return an instance of AccessibleRole describing the role of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
         * object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
         * @see AccessibleRole
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        public AccessibleRole getAccessibleRole() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
            return AccessibleRole.CANVAS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    } // inner class AccessibleAWTCanvas
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
}