Java Draw Shadow drawShadowedString(String string, int x, int y, Graphics2D g2d)

Here you can find the source of drawShadowedString(String string, int x, int y, Graphics2D g2d)

Description

draw Shadowed String

License

Open Source License

Parameter

Parameter Description
string the string to be drawn
x x position
y y position
g2d the drawing context

Declaration

public static void drawShadowedString(String string, int x, int y, Graphics2D g2d) 

Method Source Code


//package com.java2s;

import java.awt.Color;
import java.awt.Graphics2D;

public class Main {
    /**/*from  w w  w .  j  a v a 2 s  .  c om*/
     * @param   string   the string to be drawn
     * @param   x   x position
     * @param   y   y position
     * @param   g2d   the drawing context
     */
    public static void drawShadowedString(String string, int x, int y, Graphics2D g2d) {
        Color holdColor = g2d.getColor();
        g2d.setColor(Color.black);
        g2d.drawString(string, x + 1, y + 1);
        g2d.setColor(holdColor);
        g2d.drawString(string, x, y);
    }
}

Related

  1. drawShadedLine(java.awt.Graphics2D g2, float x0, float y0, float x1, float y1, java.awt.Paint topLeftPaint, java.awt.Paint otherPaint, java.awt.Paint bottomRightPaint, java.awt.geom.GeneralPath buffer)
  2. drawShadow(Graphics2D g2d, Color topColor, float opacity, int shadowWidth, int cornerRadius, int x, int y, int width, int height)
  3. drawShadowedShape(Shape shape, Graphics2D g2d)
  4. drawShadowedString(Graphics2D g2d, String label, Color textColor, Color shadowColor, int x, int y)