gt:             throw new NotImplementedException();
context: /*
   *  Licensed to the Apache Software Foundation (ASF) under one or more
   *  contributor license agreements.  See the NOTICE file distributed with
   *  this work for additional information regarding copyright ownership.
   *  The ASF licenses this file to You under the Apache License, Version 2.0
   *  (the "License"); you may not use this file except in compliance with
   *  the License.  You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  
  package java.awt;
  
  import java.awt.dnd.DropTarget;
  import java.awt.event.ComponentEvent;
  import java.awt.event.ComponentListener;
  import java.awt.event.FocusEvent;
  import java.awt.event.FocusListener;
  import java.awt.event.HierarchyBoundsListener;
  import java.awt.event.HierarchyEvent;
  import java.awt.event.HierarchyListener;
  import java.awt.event.InputMethodEvent;
  import java.awt.event.InputMethodListener;
  import java.awt.event.InvocationEvent;
  import java.awt.event.KeyEvent;
  import java.awt.event.KeyListener;
  import java.awt.event.MouseEvent;
  import java.awt.event.MouseListener;
  import java.awt.event.MouseMotionListener;
  import java.awt.event.MouseWheelEvent;
  import java.awt.event.MouseWheelListener;
  import java.awt.event.PaintEvent;
  import java.awt.event.WindowEvent;
  import java.awt.im.InputContext;
  import java.awt.im.InputMethodRequests;
  import java.awt.image.BufferStrategy;
  import java.awt.image.BufferedImage;
  import java.awt.image.ColorModel;
  import java.awt.image.ImageObserver;
  import java.awt.image.ImageProducer;
  import java.awt.image.VolatileImage;
  import java.awt.image.WritableRaster;
  import java.awt.peer.ComponentPeer;
  import java.beans.PropertyChangeListener;
  import java.beans.PropertyChangeSupport;
  import java.io.IOException;
  import java.io.ObjectInputStream;
  import java.io.PrintStream;
  import java.io.PrintWriter;
  import java.io.Serializable;
  import java.lang.reflect.Array;
  import java.lang.reflect.Method;
  import java.security.AccessController;
  import java.security.PrivilegedAction;
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.EventListener;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.Hashtable;
  import java.util.Iterator;
  import java.util.LinkedList;
  import java.util.Locale;
  import java.util.Map;
  import java.util.Set;
  
  import javax.accessibility.Accessible;
  import javax.accessibility.AccessibleComponent;
  import javax.accessibility.AccessibleContext;
  import javax.accessibility.AccessibleRole;
  import javax.accessibility.AccessibleState;
  import javax.accessibility.AccessibleStateSet;
  
  import org.apache.harmony.awt.ClipRegion;
  import org.apache.harmony.awt.FieldsAccessor;
  import org.apache.harmony.awt.gl.CommonGraphics2D;
  import org.apache.harmony.awt.gl.MultiRectArea;
  import org.apache.harmony.awt.internal.nls.Messages;
  import org.apache.harmony.awt.state.State;
  import org.apache.harmony.awt.text.TextFieldKit;
  import org.apache.harmony.awt.text.TextKit;
  import org.apache.harmony.awt.wtk.NativeWindow;
  import org.apache.harmony.luni.util.NotImplementedException;
  
  public abstract class Component implements ImageObserver, MenuContainer, Serializable {
      private static final long serialVersionUID = -7644114512714619750L;
  
      public static final float TOP_ALIGNMENT = 0.0f;
  
      public static final float CENTER_ALIGNMENT = 0.5f;
  
      public static final float BOTTOM_ALIGNMENT = 1.0f;
  
      public static final float LEFT_ALIGNMENT = 0.0f;
  
      public static final float RIGHT_ALIGNMENT = 1.0f;
  
      private static final Hashtable<Class<?>, Boolean> childClassesFlags = new Hashtable<Class<?>, Boolean>();
  
      private static final ComponentPeer peer = new ComponentPeer() {
      };
  
      private static final boolean incrementalImageUpdate;
  
      final transient Toolkit toolkit = Toolkit.getDefaultToolkit();
  
      protected abstract class AccessibleAWTComponent extends AccessibleContext implements
              Serializable, AccessibleComponent {
          private static final long serialVersionUID = 642321655757800191L;
  
          protected class AccessibleAWTComponentHandler implements ComponentListener {
              protected AccessibleAWTComponentHandler() {
              }
  
              public void componentHidden(ComponentEvent e) {
                  if (behaviour.isLightweight()) {
                      return;
                  }
                  firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                          AccessibleState.VISIBLE, null);
              }
  
              public void componentMoved(ComponentEvent e) {
              }
  
              public void componentResized(ComponentEvent e) {
              }
  
              public void componentShown(ComponentEvent e) {
                  if (behaviour.isLightweight()) {
                      return;
                  }
                  firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null,
                          AccessibleState.VISIBLE);
              }
          }
  
          protected class AccessibleAWTFocusHandler implements FocusListener {
              public void focusGained(FocusEvent e) {
                  if (behaviour.isLightweight()) {
                      return;
                  }
                  firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null,
                          AccessibleState.FOCUSED);
              }
  
              public void focusLost(FocusEvent e) {
                  if (behaviour.isLightweight()) {
                      return;
                  }
                  firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                          AccessibleState.FOCUSED, null);
              }
          }
  
          protected ComponentListener accessibleAWTComponentHandler;
  
          protected FocusListener accessibleAWTFocusHandler;
  
          /**
           * Number of registered property change listeners
           */
          int listenersCount;
  
          public void addFocusListener(FocusListener l) {
              Component.this.addFocusListener(l);
          }
  
          @Override
          public void addPropertyChangeListener(PropertyChangeListener listener) {
              toolkit.lockAWT();
              try {
                  super.addPropertyChangeListener(listener);
                  listenersCount++;
                  if (accessibleAWTComponentHandler == null) {
                      accessibleAWTComponentHandler = new AccessibleAWTComponentHandler();
                      Component.this.addComponentListener(accessibleAWTComponentHandler);
                  }
                  if (accessibleAWTFocusHandler == null) {
                      accessibleAWTFocusHandler = new AccessibleAWTFocusHandler();
                      Component.this.addFocusListener(accessibleAWTFocusHandler);
                  }
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public boolean contains(Point p) {
              toolkit.lockAWT();
              try {
                  return Component.this.contains(p);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public Accessible getAccessibleAt(Point arg0) {
              toolkit.lockAWT();
              try {
                  return null;
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public Color getBackground() {
              toolkit.lockAWT();
              try {
                  return Component.this.getBackground();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public Rectangle getBounds() {
              toolkit.lockAWT();
              try {
                  return Component.this.getBounds();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public Cursor getCursor() {
              toolkit.lockAWT();
              try {
                  return Component.this.getCursor();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public Font getFont() {
              toolkit.lockAWT();
              try {
                  return Component.this.getFont();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public FontMetrics getFontMetrics(Font f) {
              toolkit.lockAWT();
              try {
                  return Component.this.getFontMetrics(f);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public Color getForeground() {
              toolkit.lockAWT();
              try {
                  return Component.this.getForeground();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public Point getLocation() {
              toolkit.lockAWT();
              try {
                  return Component.this.getLocation();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public Point getLocationOnScreen() {
              toolkit.lockAWT();
              try {
                  return Component.this.getLocationOnScreen();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public Dimension getSize() {
              toolkit.lockAWT();
              try {
                  return Component.this.getSize();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public boolean isEnabled() {
              toolkit.lockAWT();
              try {
                  return Component.this.isEnabled();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public boolean isFocusTraversable() {
              toolkit.lockAWT();
              try {
                  return Component.this.isFocusTraversable();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public boolean isShowing() {
              toolkit.lockAWT();
              try {
                  return Component.this.isShowing();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public boolean isVisible() {
              toolkit.lockAWT();
              try {
                  return Component.this.isVisible();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void removeFocusListener(FocusListener l) {
              Component.this.removeFocusListener(l);
          }
  
          @Override
          public void removePropertyChangeListener(PropertyChangeListener listener) {
              toolkit.lockAWT();
              try {
                  super.removePropertyChangeListener(listener);
                  listenersCount--;
                  if (listenersCount > 0) {
                      return;
                  }
                  // if there are no more listeners, remove handlers:
                  Component.this.removeFocusListener(accessibleAWTFocusHandler);
                  Component.this.removeComponentListener(accessibleAWTComponentHandler);
                  accessibleAWTComponentHandler = null;
                  accessibleAWTFocusHandler = null;
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void requestFocus() {
              toolkit.lockAWT();
              try {
                  Component.this.requestFocus();
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void setBackground(Color color) {
              toolkit.lockAWT();
              try {
                  Component.this.setBackground(color);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void setBounds(Rectangle r) {
              toolkit.lockAWT();
              try {
                  Component.this.setBounds(r);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void setCursor(Cursor cursor) {
              toolkit.lockAWT();
              try {
                  Component.this.setCursor(cursor);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void setEnabled(boolean enabled) {
              toolkit.lockAWT();
              try {
                  Component.this.setEnabled(enabled);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void setFont(Font f) {
              toolkit.lockAWT();
              try {
                  Component.this.setFont(f);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void setForeground(Color color) {
              toolkit.lockAWT();
              try {
                  Component.this.setForeground(color);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void setLocation(Point p) {
              toolkit.lockAWT();
              try {
                  Component.this.setLocation(p);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void setSize(Dimension size) {
              toolkit.lockAWT();
              try {
                  Component.this.setSize(size);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          public void setVisible(boolean visible) {
              toolkit.lockAWT();
              try {
                  Component.this.setVisible(visible);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          @Override
          public Accessible getAccessibleParent() {
              toolkit.lockAWT();
              try {
                  Accessible aParent = super.getAccessibleParent();
                  if (aParent != null) {
                      return aParent;
                  }
                  Container parent = getParent();
                  return (parent instanceof Accessible ? (Accessible) parent : null);
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          @Override
          public Accessible getAccessibleChild(int i) {
              toolkit.lockAWT();
              try {
                  return null;
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          @Override
          public int getAccessibleChildrenCount() {
              toolkit.lockAWT();
              try {
                  return 0;
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          @Override
          public AccessibleComponent getAccessibleComponent() {
              return this;
          }
  
          @Override
          public String getAccessibleDescription() {
              return super.getAccessibleDescription(); // why override?
          }
  
          @Override
          public int getAccessibleIndexInParent() {
              toolkit.lockAWT();
              try {
                  if (getAccessibleParent() == null) {
                      return -1;
                  }
                  int count = 0;
                  Container parent = getParent();
                  for (int i = 0; i < parent.getComponentCount(); i++) {
                      Component aComp = parent.getComponent(i);
                      if (aComp instanceof Accessible) {
                          if (aComp == Component.this) {
                              return count;
                          }
                          ++count;
                      }
                  }
                  return -1;
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          @Override
          public AccessibleRole getAccessibleRole() {
              toolkit.lockAWT();
              try {
                  return AccessibleRole.AWT_COMPONENT;
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          @Override
          public AccessibleStateSet getAccessibleStateSet() {
              toolkit.lockAWT();
              try {
                  AccessibleStateSet set = new AccessibleStateSet();
                  if (isEnabled()) {
                      set.add(AccessibleState.ENABLED);
                  }
                  if (isFocusable()) {
                      set.add(AccessibleState.FOCUSABLE);
                  }
                  if (hasFocus()) {
                      set.add(AccessibleState.FOCUSED);
                  }
                  if (isOpaque()) {
                      set.add(AccessibleState.OPAQUE);
                  }
                  if (isShowing()) {
                      set.add(AccessibleState.SHOWING);
                  }
                  if (isVisible()) {
                      set.add(AccessibleState.VISIBLE);
                  }
                  return set;
              } finally {
                  toolkit.unlockAWT();
              }
          }
  
          @Override
          public Locale getLocale() throws IllegalComponentStateException {
              toolkit.lockAWT();
              try {
                  return Component.this.getLocale();
              } finally {
                  toolkit.unlockAWT();
              }
          }
      }
  
      protected class BltBufferStrategy extends BufferStrategy {
          protected VolatileImage[] backBuffers;
  
          protected BufferCapabilities caps;
  
          protected int width;
  
          protected int height;
  
          protected boolean validatedContents;
  
          protected BltBufferStrategy(int numBuffers, BufferCapabilities caps) throws NotImplementedException {
              throw new NotImplementedException();
          }
  
          @Override
          public boolean contentsLost() throws NotImplementedException {
              throw new NotImplementedException();
          }
  
          @Override
          public boolean contentsRestored() throws NotImplementedException {
              throw new NotImplementedException();
          }
  
          protected void createBackBuffers(int numBuffers) throws NotImplementedException {
              throw new NotImplementedException();
          }
  
          @Override
          public BufferCapabilities getCapabilities() {
              return (BufferCapabilities) caps.clone();
          }
  
          @Override
          public Graphics getDrawGraphics() throws NotImplementedException {
              throw new NotImplementedException();
          }
  
          protected void revalidate() throws NotImplementedException {
              throw new NotImplementedException();
          }
  
          @Override
          public void show() throws NotImplementedException {
              throw new NotImplementedException();
          }
      }
  
      protected class FlipBufferStrategy extends BufferStrategy {
          protected BufferCapabilities caps;
  
          protected Image drawBuffer;
  
          protected VolatileImage drawVBuffer;
  
          protected int numBuffers;
  
          protected boolean validatedContents;
  
          protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
                  throws AWTException {
              if (!(Component.this instanceof Window) && !(Component.this instanceof Canvas)) {
                  // awt.14B=Only Canvas or Window is allowed
                  throw new ClassCastException(Messages.getString("awt.14B")); //$NON-NLS-1$
              }
              // TODO: throw new AWTException("Capabilities are not supported");
              this.numBuffers = numBuffers;
              this.caps = (BufferCapabilities) caps.clone();
          }
  
          @Override
          public boolean contentsLost() throws NotImplementedException {
              throw new NotImplementedException();
          }
  
          @Override
          public boolean contentsRestored() throws NotImplementedException {
  