Пример #1
0
 /**
  * fill - overrides parent method
  *
  * <p>See implementation comments in the AEllipse class.
  */
 public void fill(java.awt.Graphics2D brush2D) {
   Color savedColor = brush2D.getColor();
   brush2D.setColor(_fillColor);
   brush2D.fill(this); // "this" class, ARoundRectangle, is subclass
   // of java.awt.geom.Rectangle2D.Double
   // A Graphics2D object knows how to fill it.
   brush2D.setColor(savedColor);
 }
Пример #2
0
 /**
  * draw - overrides parent method
  *
  * <p>See implementation comments in the AEllipse class.
  */
 public void draw(java.awt.Graphics2D brush2D) {
   Color savedColor = brush2D.getColor();
   brush2D.setColor(_borderColor);
   java.awt.Stroke savedStroke = brush2D.getStroke();
   brush2D.setStroke(new java.awt.BasicStroke(_lineWidth));
   brush2D.draw(this); // "this" class, ARoundRectangle, is subclass
   // of java.awt.geom.Rectangle2D.Double
   // A Graphics2D object knows how to draw the
   // the border of this kind of object.
   brush2D.setStroke(savedStroke);
   brush2D.setColor(savedColor);
 }
Пример #3
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);
    }
  }