001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Dmitry A. Durnev
019: * @version $Revision$
020: */package java.awt;
021:
022: import java.awt.image.BufferStrategy;
023: import javax.accessibility.Accessible;
024: import javax.accessibility.AccessibleContext;
025: import javax.accessibility.AccessibleRole;
026:
027: public class Canvas extends Component implements Accessible {
028: private static final long serialVersionUID = -2284879212465893870L;
029:
030: protected class AccessibleAWTCanvas extends AccessibleAWTComponent {
031: private static final long serialVersionUID = -6325592262103146699L;
032:
033: @Override
034: public AccessibleRole getAccessibleRole() {
035: return AccessibleRole.CANVAS;
036: }
037: }
038:
039: public Canvas() {
040: toolkit.lockAWT();
041: try {
042: } finally {
043: toolkit.unlockAWT();
044: }
045: }
046:
047: public Canvas(GraphicsConfiguration a0) {
048: this ();
049: toolkit.lockAWT();
050: try {
051: } finally {
052: toolkit.unlockAWT();
053: }
054: }
055:
056: @Override
057: public void update(Graphics g) {
058: toolkit.lockAWT();
059: try {
060: super .update(g);
061: } finally {
062: toolkit.unlockAWT();
063: }
064: }
065:
066: @Override
067: public void addNotify() {
068: toolkit.lockAWT();
069: try {
070: super .addNotify();
071: } finally {
072: toolkit.unlockAWT();
073: }
074: }
075:
076: public void createBufferStrategy(int a0)
077: throws org.apache.harmony.luni.util.NotImplementedException {
078: toolkit.lockAWT();
079: try {
080: } finally {
081: toolkit.unlockAWT();
082: }
083: if (true) {
084: throw new RuntimeException("Method is not implemented"); //TODO: implement //$NON-NLS-1$
085: }
086: return;
087: }
088:
089: public void createBufferStrategy(int a0, BufferCapabilities a1)
090: throws AWTException,
091: org.apache.harmony.luni.util.NotImplementedException {
092: toolkit.lockAWT();
093: try {
094: } finally {
095: toolkit.unlockAWT();
096: }
097: if (true) {
098: throw new RuntimeException("Method is not implemented"); //TODO: implement //$NON-NLS-1$
099: }
100: return;
101: }
102:
103: @Override
104: public AccessibleContext getAccessibleContext() {
105: return super .getAccessibleContext();
106: }
107:
108: public BufferStrategy getBufferStrategy()
109: throws org.apache.harmony.luni.util.NotImplementedException {
110: toolkit.lockAWT();
111: try {
112: } finally {
113: toolkit.unlockAWT();
114: }
115: if (true) {
116: throw new RuntimeException("Method is not implemented"); //TODO: implement //$NON-NLS-1$
117: }
118: return null;
119: }
120:
121: @Override
122: public void paint(Graphics g) {
123: toolkit.lockAWT();
124: try {
125: // just do nothing
126: } finally {
127: toolkit.unlockAWT();
128: }
129: }
130:
131: @Override
132: Dimension getDefaultMinimumSize() {
133: return new Dimension(w, h);
134: }
135:
136: @Override
137: ComponentBehavior createBehavior() {
138: return GraphicsEnvironment.getLocalGraphicsEnvironment()
139: .isHeadlessInstance() ? new LWBehavior(this )
140: : new HWBehavior(this );
141: }
142:
143: @Override
144: String autoName() {
145: return ("canvas" + toolkit.autoNumber.nextCanvas++); //$NON-NLS-1$
146: }
147:
148: @Override
149: AccessibleContext createAccessibleContext() {
150: return new AccessibleAWTCanvas();
151: }
152: }
|