Java Graphics Draw raiseRect(Graphics2D g2, Rectangle r, Color foreColor)

Here you can find the source of raiseRect(Graphics2D g2, Rectangle r, Color foreColor)

Description

draw an image in a rectangle

License

Apache License

Parameter

Parameter Description
gr non-null graphic context
img non-null image
r non-null rectangle
obs non-null observer

Declaration

public static void raiseRect(Graphics2D g2, Rectangle r, Color foreColor) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.*;

public class Main {
    /**//from w  ww  . j  a va 2 s. co m
     * draw an image in a rectangle
     *
     * @param gr  non-null graphic context
     * @param img non-null image
     * @param r   non-null rectangle
     * @param obs non-null observer
     */
    public static void raiseRect(Graphics2D g2, Rectangle r, Color foreColor) {
        Color oldColor = g2.getColor();
        g2.setColor(foreColor);
        g2.fill3DRect(r.x, r.y, r.width, r.height, true);
        g2.setColor(oldColor);

    }
}

Related

  1. paintShape(Shape shape, Graphics2D g2d, Color colorStroke, Stroke stroke, Color colorFill, double downsample)
  2. paintSprite(Graphics g, int x, int y, int[][] sprite, Color[] colors)
  3. prepareGraphics(Graphics g)
  4. printAll(java.awt.Graphics2D g2, java.awt.Component component)
  5. raiseOval(Graphics2D g2, Rectangle r, Color foreColor)
  6. renderByLineGraphics(JComponent c, Graphics g)
  7. renderGraphics(JComponent c, Graphics g)
  8. useAntiAliasing(Graphics2D g)