Ejemplo n.º 1
0
  public void fill(java.awt.Color color) {
    if (color == null) {
      String message = Logging.getMessage("nullValue.ColorIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    java.awt.Graphics2D g2d = this.getGraphics();

    // Keep track of the previous color.
    java.awt.Color prevColor = g2d.getColor();
    try {
      // Fill the raster with the specified color.
      g2d.setColor(color);
      g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
    } finally {
      // Restore the previous color.
      g2d.setColor(prevColor);
    }
  }