bugfixproxygraphics2d.java

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

JAVA
1,607
字号
   */
  public Stroke getStroke()
  {
    return parent.getStroke();
  }

  /**
   * Intersects the current <code>Clip</code> with the interior of the
   * specified <code>Shape</code> and sets the <code>Clip</code> to the
   * resulting intersection.  The specified <code>Shape</code> is
   * transformed with the current <code>Graphics2D</code>
   * <code>Transform</code> before being intersected with the current
   * <code>Clip</code>.  This method is used to make the current
   * <code>Clip</code> smaller.
   * To make the <code>Clip</code> larger, use <code>setClip</code>.
   * The <i>user clip</i> modified by this method is independent of the
   * clipping associated with device bounds and visibility.  If no clip has
   * previously been set, or if the clip has been cleared using
   * {@link Graphics#setClip(Shape) setClip} with a <code>null</code>
   * argument, the specified <code>Shape</code> becomes the new
   * user clip.
   * @param s the <code>Shape</code> to be intersected with the current
   *          <code>Clip</code>.  If <code>s</code> is <code>null</code>,
   *          this method clears the current <code>Clip</code>.
   */
  public void clip(final Shape s)
  {
    parent.clip(s);
  }

  /**
   * Get the rendering context of the <code>Font</code> within this
   * <code>Graphics2D</code> context.
   * The {@link FontRenderContext}
   * encapsulates application hints such as anti-aliasing and
   * fractional metrics, as well as target device specific information
   * such as dots-per-inch.  This information should be provided by the
   * application when using objects that perform typographical
   * formatting, such as <code>Font</code> and
   * <code>TextLayout</code>.  This information should also be provided
   * by applications that perform their own layout and need accurate
   * measurements of various characteristics of glyphs such as advance
   * and line height when various rendering hints have been applied to
   * the text rendering.
   *
   * @return a reference to an instance of FontRenderContext.
   * @see FontRenderContext
   * @see Font#createGlyphVector
   * @see java.awt.font.TextLayout
   * @since     1.2
   */

  public FontRenderContext getFontRenderContext()
  {
    return parent.getFontRenderContext();
  }

  /**
   * Creates a new <code>Graphics</code> object that is
   * a copy of this <code>Graphics</code> object.
   * @return     a new graphics context that is a copy of
   *                       this graphics context.
   */
  public Graphics create()
  {
    return new BugFixProxyGraphics2D((Graphics2D) parent.create());
  }

  /**
   * Gets this graphics context's current color.
   * @return    this graphics context's current color.
   * @see       Color
   * @see       Graphics#setColor(Color)
   */
  public Color getColor()
  {
    return parent.getColor();
  }

  /**
   * Sets this graphics context's current color to the specified
   * color. All subsequent graphics operations using this graphics
   * context use this specified color.
   * @param     c   the new rendering color.
   * @see       Color
   * @see       Graphics#getColor
   */
  public void setColor(final Color c)
  {
    parent.setColor(c);
  }

  /**
   * Sets the paint mode of this graphics context to overwrite the
   * destination with this graphics context's current color.
   * This sets the logical pixel operation function to the paint or
   * overwrite mode.  All subsequent rendering operations will
   * overwrite the destination with the current color.
   */
  public void setPaintMode()
  {
    parent.setPaintMode();
  }

  /**
   * Sets the paint mode of this graphics context to alternate between
   * this graphics context's current color and the new specified color.
   * This specifies that logical pixel operations are performed in the
   * XOR mode, which alternates pixels between the current color and
   * a specified XOR color.
   * <p>
   * When drawing operations are performed, pixels which are the
   * current color are changed to the specified color, and vice versa.
   * <p>
   * Pixels that are of colors other than those two colors are changed
   * in an unpredictable but reversible manner; if the same figure is
   * drawn twice, then all pixels are restored to their original values.
   * @param     c1 the XOR alternation color
   */
  public void setXORMode(final Color c1)
  {
    parent.setXORMode(c1);
  }

  /**
   * Gets the current font.
   * @return    this graphics context's current font.
   * @see       Font
   * @see       Graphics#setFont(Font)
   */
  public Font getFont()
  {
    return parent.getFont();
  }

  /**
   * Sets this graphics context's font to the specified font.
   * All subsequent text operations using this graphics context
   * use this font.
   * @param  font   the font.
   * @see     Graphics#getFont
   * @see     Graphics#drawString(String, int, int)
   * @see     Graphics#drawBytes(byte[], int, int, int, int)
   * @see     Graphics#drawChars(char[], int, int, int, int)
   */
  public void setFont(final Font font)
  {
    parent.setFont(font);
  }

  /**
   * Gets the font metrics for the specified font.
   * @return    the font metrics for the specified font.
   * @param     f the specified font
   * @see       Graphics#getFont
   * @see       FontMetrics
   * @see       Graphics#getFontMetrics()
   */
  public FontMetrics getFontMetrics(final Font f)
  {
    return parent.getFontMetrics(f);
  }

  /**
   * Returns the bounding rectangle of the current clipping area.
   * This method refers to the user clip, which is independent of the
   * clipping associated with device bounds and window visibility.
   * If no clip has previously been set, or if the clip has been
   * cleared using <code>setClip(null)</code>, this method returns
   * <code>null</code>.
   * The coordinates in the rectangle are relative to the coordinate
   * system origin of this graphics context.
   * @return      the bounding rectangle of the current clipping area,
   *              or <code>null</code> if no clip is set.
   * @see         Graphics#getClip
   * @see         Graphics#clipRect
   * @see         Graphics#setClip(int, int, int, int)
   * @see         Graphics#setClip(Shape)
   * @since       JDK1.1
   */
  public Rectangle getClipBounds()
  {
    return parent.getClipBounds();
  }

  /**
   * Intersects the current clip with the specified rectangle.
   * The resulting clipping area is the intersection of the current
   * clipping area and the specified rectangle.  If there is no
   * current clipping area, either because the clip has never been
   * set, or the clip has been cleared using <code>setClip(null)</code>,
   * the specified rectangle becomes the new clip.
   * This method sets the user clip, which is independent of the
   * clipping associated with device bounds and window visibility.
   * This method can only be used to make the current clip smaller.
   * To set the current clip larger, use any of the setClip methods.
   * Rendering operations have no effect outside of the clipping area.
   * @param x the x coordinate of the rectangle to intersect the clip with
   * @param y the y coordinate of the rectangle to intersect the clip with
   * @param width the width of the rectangle to intersect the clip with
   * @param height the height of the rectangle to intersect the clip with
   * @see #setClip(int, int, int, int)
   * @see #setClip(Shape)
   */
  public void clipRect(final int x, final int y, final int width, final int height)
  {
    // fix a bug in the tree renderer ...
    parent.clip(new Rectangle(x, y, width, height));
  }

  /**
   * Sets the current clip to the rectangle specified by the given
   * coordinates.  This method sets the user clip, which is
   * independent of the clipping associated with device bounds
   * and window visibility.
   * Rendering operations have no effect outside of the clipping area.
   * @param       x the <i>x</i> coordinate of the new clip rectangle.
   * @param       y the <i>y</i> coordinate of the new clip rectangle.
   * @param       width the width of the new clip rectangle.
   * @param       height the height of the new clip rectangle.
   * @see         Graphics#clipRect
   * @see         Graphics#setClip(Shape)
   * @see         Graphics#getClip
   * @since       JDK1.1
   */
  public void setClip(final int x, final int y, final int width, final int height)
  {
    parent.setClip(new Rectangle(x, y, width, height));
  }

  /**
   * Gets the current clipping area.
   * This method returns the user clip, which is independent of the
   * clipping associated with device bounds and window visibility.
   * If no clip has previously been set, or if the clip has been
   * cleared using <code>setClip(null)</code>, this method returns
   * <code>null</code>.
   * @return      a <code>Shape</code> object representing the
   *              current clipping area, or <code>null</code> if
   *              no clip is set.
   * @see         Graphics#getClipBounds
   * @see         Graphics#clipRect
   * @see         Graphics#setClip(int, int, int, int)
   * @see         Graphics#setClip(Shape)
   * @since       JDK1.1
   */
  public Shape getClip()
  {
    return parent.getClip();
  }

  /**
   * Sets the current clipping area to an arbitrary clip shape.
   * Not all objects that implement the <code>Shape</code>
   * interface can be used to set the clip.  The only
   * <code>Shape</code> objects that are guaranteed to be
   * supported are <code>Shape</code> objects that are
   * obtained via the <code>getClip</code> method and via
   * <code>Rectangle</code> objects.  This method sets the
   * user clip, which is independent of the clipping associated
   * with device bounds and window visibility.
   * @param clip the <code>Shape</code> to use to set the clip
   * @see         Graphics#getClip()
   * @see         Graphics#clipRect
   * @see         Graphics#setClip(int, int, int, int)
   * @since       JDK1.1
   */
  public void setClip(final Shape clip)
  {
    parent.setClip(clip);
  }

  /**
   * Copies an area of the component by a distance specified by
   * <code>dx</code> and <code>dy</code>. From the point specified
   * by <code>x</code> and <code>y</code>, this method
   * copies downwards and to the right.  To copy an area of the
   * component to the left or upwards, specify a negative value for
   * <code>dx</code> or <code>dy</code>.
   * If a portion of the source rectangle lies outside the bounds
   * of the component, or is obscured by another window or component,
   * <code>copyArea</code> will be unable to copy the associated
   * pixels. The area that is omitted can be refreshed by calling
   * the component's <code>paint</code> method.
   * @param       x the <i>x</i> coordinate of the source rectangle.
   * @param       y the <i>y</i> coordinate of the source rectangle.
   * @param       width the width of the source rectangle.
   * @param       height the height of the source rectangle.
   * @param       dx the horizontal distance to copy the pixels.
   * @param       dy the vertical distance to copy the pixels.
   */
  public void copyArea(final int x, final int y, final int width, final int height,
                       final int dx, final int dy)
  {
    parent.copyArea(x, y, width, height, dx, dy);
  }

  /**
   * Draws a line, using the current color, between the points
   * <code>(x1,&nbsp;y1)</code> and <code>(x2,&nbsp;y2)</code>
   * in this graphics context's coordinate system.
   * @param   x1  the first point's <i>x</i> coordinate.
   * @param   y1  the first point's <i>y</i> coordinate.
   * @param   x2  the second point's <i>x</i> coordinate.
   * @param   y2  the second point's <i>y</i> coordinate.
   */
  public void drawLine(final int x1, final int y1, final int x2, final int y2)
  {
    parent.draw (new Line2D.Float(x1, y1, x2, y2));
  }

  /**
   * Fills the specified rectangle.
   * The left and right edges of the rectangle are at
   * <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>.
   * The top and bottom edges are at
   * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>.
   * The resulting rectangle covers an area
   * <code>width</code> pixels wide by
   * <code>height</code> pixels tall.
   * The rectangle is filled using the graphics context's current color.
   * @param         x   the <i>x</i> coordinate

⌨️ 快捷键说明

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