bugfixproxygraphics2d.java

来自「swing编写的库存管理程序。毕业设计类」· Java 代码 · 共 1,607 行 · 第 1/5 页

JAVA
1,607
字号
   *                         of the rectangle to be filled.
   * @param         y   the <i>y</i> coordinate
   *                         of the rectangle to be filled.
   * @param         width   the width of the rectangle to be filled.
   * @param         height   the height of the rectangle to be filled.
   * @see           Graphics#clearRect
   * @see           Graphics#drawRect
   */
  public void fillRect(final int x, final int y, final int width, final int height)
  {
    parent.fill(new Rectangle(x, y, width, height));
  }

  /**
   * Clears the specified rectangle by filling it with the background
   * color of the current drawing surface. This operation does not
   * use the current paint mode.
   * <p>
   * Beginning with Java&nbsp;1.1, the background color
   * of offscreen images may be system dependent. Applications should
   * use <code>setColor</code> followed by <code>fillRect</code> to
   * ensure that an offscreen image is cleared to a specific color.
   * @param       x the <i>x</i> coordinate of the rectangle to clear.
   * @param       y the <i>y</i> coordinate of the rectangle to clear.
   * @param       width the width of the rectangle to clear.
   * @param       height the height of the rectangle to clear.
   * @see         Graphics#fillRect(int, int, int, int)
   * @see         Graphics#drawRect
   * @see         Graphics#setColor(Color)
   * @see         Graphics#setPaintMode
   * @see         Graphics#setXORMode(Color)
   */
  public void clearRect(final int x, final int y, final int width, final int height)
  {
    parent.clearRect(x, y, width, height);
  }

  /**
   * Draws an outlined round-cornered rectangle using this graphics
   * context's current color. The left and right edges of the rectangle
   * are at <code>x</code> and <code>x&nbsp;+&nbsp;width</code>,
   * respectively. The top and bottom edges of the rectangle are at
   * <code>y</code> and <code>y&nbsp;+&nbsp;height</code>.
   * @param      x the <i>x</i> coordinate of the rectangle to be drawn.
   * @param      y the <i>y</i> coordinate of the rectangle to be drawn.
   * @param      width the width of the rectangle to be drawn.
   * @param      height the height of the rectangle to be drawn.
   * @param      arcWidth the horizontal diameter of the arc
   *                    at the four corners.
   * @param      arcHeight the vertical diameter of the arc
   *                    at the four corners.
   * @see        Graphics#fillRoundRect
   */
  public void drawRoundRect(final int x, final int y, final int width, final int height,
                            final int arcWidth, final int arcHeight)
  {
    parent.draw(new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight));
  }

  /**
   * Fills the specified rounded corner rectangle with the current color.
   * The left and right edges of the rectangle
   * are at <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>,
   * respectively. The top and bottom edges of the rectangle are at
   * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>.
   * @param       x the <i>x</i> coordinate of the rectangle to be filled.
   * @param       y the <i>y</i> coordinate of the rectangle to be filled.
   * @param       width the width of the rectangle to be filled.
   * @param       height the height of the rectangle to be filled.
   * @param       arcWidth the horizontal diameter
   *                     of the arc at the four corners.
   * @param       arcHeight the vertical diameter
   *                     of the arc at the four corners.
   * @see         Graphics#drawRoundRect
   */
  public void fillRoundRect(final int x, final int y, final int width, final int height,
                            final int arcWidth, final int arcHeight)
  {
    parent.fill(new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight));
  }

  /**
   * Draws the outline of an oval.
   * The result is a circle or ellipse that fits within the
   * rectangle specified by the <code>x</code>, <code>y</code>,
   * <code>width</code>, and <code>height</code> arguments.
   * <p>
   * The oval covers an area that is
   * <code>width&nbsp;+&nbsp;1</code> pixels wide
   * and <code>height&nbsp;+&nbsp;1</code> pixels tall.
   * @param       x the <i>x</i> coordinate of the upper left
   *                     corner of the oval to be drawn.
   * @param       y the <i>y</i> coordinate of the upper left
   *                     corner of the oval to be drawn.
   * @param       width the width of the oval to be drawn.
   * @param       height the height of the oval to be drawn.
   * @see         Graphics#fillOval
   */
  public void drawOval(final int x, final int y, final int width, final int height)
  {
    parent.draw(new Ellipse2D.Float(x, y, width, height));

  }

  /**
   * Fills an oval bounded by the specified rectangle with the
   * current color.
   * @param       x the <i>x</i> coordinate of the upper left corner
   *                     of the oval to be filled.
   * @param       y the <i>y</i> coordinate of the upper left corner
   *                     of the oval to be filled.
   * @param       width the width of the oval to be filled.
   * @param       height the height of the oval to be filled.
   * @see         Graphics#drawOval
   */
  public void fillOval(final int x, final int y, final int width, final int height)
  {
    parent.fill(new Ellipse2D.Float(x, y, width, height));
  }

  /**
   * Draws the outline of a circular or elliptical arc
   * covering the specified rectangle.
   * <p>
   * The resulting arc begins at <code>startAngle</code> and extends
   * for <code>arcAngle</code> degrees, using the current color.
   * Angles are interpreted such that 0&nbsp;degrees
   * is at the 3&nbsp;o'clock position.
   * A positive value indicates a counter-clockwise rotation
   * while a negative value indicates a clockwise rotation.
   * <p>
   * The center of the arc is the center of the rectangle whose origin
   * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the
   * <code>width</code> and <code>height</code> arguments.
   * <p>
   * The resulting arc covers an area
   * <code>width&nbsp;+&nbsp;1</code> pixels wide
   * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
   * <p>
   * The angles are specified relative to the non-square extents of
   * the bounding rectangle such that 45 degrees always falls on the
   * line from the center of the ellipse to the upper right corner of
   * the bounding rectangle. As a result, if the bounding rectangle is
   * noticeably longer in one axis than the other, the angles to the
   * start and end of the arc segment will be skewed farther along the
   * longer axis of the bounds.
   * @param        x the <i>x</i> coordinate of the
   *                    upper-left corner of the arc to be drawn.
   * @param        y the <i>y</i>  coordinate of the
   *                    upper-left corner of the arc to be drawn.
   * @param        width the width of the arc to be drawn.
   * @param        height the height of the arc to be drawn.
   * @param        startAngle the beginning angle.
   * @param        arcAngle the angular extent of the arc,
   *                    relative to the start angle.
   * @see         Graphics#fillArc
   */
  public void drawArc(final int x, final int y, final int width, final int height,
                      final int startAngle, final int arcAngle)
  {
    parent.fill(new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.PIE));
  }

  /**
   * Fills a circular or elliptical arc covering the specified rectangle.
   * <p>
   * The resulting arc begins at <code>startAngle</code> and extends
   * for <code>arcAngle</code> degrees.
   * Angles are interpreted such that 0&nbsp;degrees
   * is at the 3&nbsp;o'clock position.
   * A positive value indicates a counter-clockwise rotation
   * while a negative value indicates a clockwise rotation.
   * <p>
   * The center of the arc is the center of the rectangle whose origin
   * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the
   * <code>width</code> and <code>height</code> arguments.
   * <p>
   * The resulting arc covers an area
   * <code>width&nbsp;+&nbsp;1</code> pixels wide
   * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
   * <p>
   * The angles are specified relative to the non-square extents of
   * the bounding rectangle such that 45 degrees always falls on the
   * line from the center of the ellipse to the upper right corner of
   * the bounding rectangle. As a result, if the bounding rectangle is
   * noticeably longer in one axis than the other, the angles to the
   * start and end of the arc segment will be skewed farther along the
   * longer axis of the bounds.
   * @param        x the <i>x</i> coordinate of the
   *                    upper-left corner of the arc to be filled.
   * @param        y the <i>y</i>  coordinate of the
   *                    upper-left corner of the arc to be filled.
   * @param        width the width of the arc to be filled.
   * @param        height the height of the arc to be filled.
   * @param        startAngle the beginning angle.
   * @param        arcAngle the angular extent of the arc,
   *                    relative to the start angle.
   * @see         Graphics#drawArc
   */
  public void fillArc(final int x, final int y, final int width, final int height,
                      final int startAngle, final int arcAngle)
  {
    parent.fill(new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.PIE));
  }

  /**
   * Draws a sequence of connected lines defined by
   * arrays of <i>x</i> and <i>y</i> coordinates.
   * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point.
   * The figure is not closed if the first point
   * differs from the last point.
   * @param       xPoints an array of <i>x</i> points
   * @param       yPoints an array of <i>y</i> points
   * @param       nPoints the total number of points
   * @see         Graphics#drawPolygon(int[], int[], int)
   * @since       JDK1.1
   */
  public void drawPolyline(final int[] xPoints, final int[] yPoints,
                           final int nPoints)
  {
    parent.drawPolyline(xPoints, yPoints, nPoints);

  }

  /**
   * Draws a closed polygon defined by
   * arrays of <i>x</i> and <i>y</i> coordinates.
   * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point.
   * <p>
   * This method draws the polygon defined by <code>nPoint</code> line
   * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code>
   * line segments are line segments from
   * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code>
   * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for
   * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>.
   * The figure is automatically closed by drawing a line connecting
   * the final point to the first point, if those points are different.
   * @param        xPoints   a an array of <code>x</code> coordinates.
   * @param        yPoints   a an array of <code>y</code> coordinates.
   * @param        nPoints   a the total number of points.
   * @see          Graphics#fillPolygon
   * @see          Graphics#drawPolyline
   */
  public void drawPolygon(final int[] xPoints, final int[] yPoints,
                          final int nPoints)
  {
    parent.draw (new Polygon(xPoints, yPoints, nPoints));
  }

  /**
   * Fills a closed polygon defined by
   * arrays of <i>x</i> and <i>y</i> coordinates.
   * <p>
   * This method draws the polygon defined by <code>nPoint</code> line
   * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code>
   * line segments are line segments from
   * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code>
   * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for
   * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>.
   * The figure is automatically closed by drawing a line connecting
   * the final point to the first point, if those points are different.
   * <p>
   * The area inside the polygon is defined using an
   * even-odd fill rule, also known as the alternating rule.
   * @param        xPoints   a an array of <code>x</code> coordinates.
   * @param        yPoints   a an array of <code>y</code> coordinates.
   * @param        nPoints   a the total number of points.
   * @see          Graphics#drawPolygon(int[], int[], int)
   */
  public void fillPolygon(final int[] xPoints, final int[] yPoints,
                          final int nPoints)
  {
    parent.fill(new Polygon(xPoints,yPoints, nPoints));
  }

  /**
   * Draws as much of the specified image as is currently available.
   * The image is drawn with its top-left corner at
   * (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's coordinate
   * space. Transparent pixels in the image do not affect whatever
   * pixels are already there.
   * <p>
   * This method returns immediately in all cases, even if the
   * complete image has not yet been loaded, and it has not been dithered
   * and converted for the current output device.
   * <p>
   * If the image has not yet been completely loaded, then
   * <code>drawImage</code> returns <code>false</code>. As more of
   * the image becomes available, the process that draws the image notifies
   * the specified image observer.
   * @param    img the specified image to be drawn.
   * @param    x   the <i>x</i> coordinate.
   * @param    y   the <i>y</i> coordinate.
   * @param    observer    object to be notified as more of
   *                          the image is converted.
   * @return   <code>true</code> if the image is completely loaded;
   *           <code>false</code> otherwise.
   * @see      Image
   * @see      ImageObserver
   * @see      ImageObserver#imageUpdate(Image, int, int, int, int, int)
   */
  public boolean drawImage(final Image img, final int x, final int y,
                           final ImageObserver observer)
  {
    return parent.drawImage(img, x, y, observer);
  }

  /**
   * Draws as much of the specified image as has already been scaled
   * to fit inside the specified rectangle.
   * <p>
   * The image is drawn inside the specified rectangle of this
   * graphics context's coordinate space, and is scaled if
   * necessary. Transparent pixels do not affect whatever pixels
   * are already there.
   * <p>
   * This method returns immediately in all cases, even if the
   * entire image has not yet been scaled, dithered, and converted
   * for the current output device.
   * If the current output representation is not yet complete, then
   * <code>drawImage</code> returns <code>false</code>. As more of
   * the image becomes available, the process that draws the image notifies

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?