paintArea = null; } }
  public void handleEvent(AWTEvent e)  {    switch (e.getID())    {      case PaintEvent.UPDATE:      case PaintEvent.PAINT:        // This only will work when the component is showing.        if (awtComponent.isShowing())          {        Graphics g = getGraphics();        Rectangle clip = ((PaintEvent)e).getUpdateRect();        g.clipRect(clip.x, clip.y, clip.width, clip.height);        //if (this instanceof LightweightPeer)        //  {            if (e.getID() == PaintEvent.UPDATE)              awtComponent.update(g);            else              awtComponent.paint(g);        //  }        // We paint the 'heavyweights' at last, so that they appear on top of        // everything else.        peerPaint(g);        g.dispose();          }        break;      case MouseEvent.MOUSE_PRESSED:      case MouseEvent.MOUSE_RELEASED:      case MouseEvent.MOUSE_CLICKED:      case MouseEvent.MOUSE_ENTERED:      case MouseEvent.MOUSE_EXITED:        handleMouseEvent((MouseEvent) e);        break;      case MouseEvent.MOUSE_MOVED:      case MouseEvent.MOUSE_DRAGGED:        handleMouseMotionEvent((MouseEvent) e);        break;      case KeyEvent.KEY_PRESSED:      case KeyEvent.KEY_RELEASED:      case KeyEvent.KEY_TYPED:        handleKeyEvent((KeyEvent) e);        break;      default:        // Other event types are not handled here.        break;    }  }