private Dimension textExtent() {
    // metrics may not have been defined yet if no drawing
    // has occurred, however the error is removed upon first
    // redrawing.
    int fWidth;
    int fHeight; 
    if ( metrics == null ) {
      fWidth = 50;
      fHeight = 20;
    } else {
      fWidth = metrics.stringWidth(text);
      fHeight = metrics.getHeight();
    }
    return new Dimension(fWidth, fHeight);
  }