Java Draw Outline drawOutlinedString(String s, int x, int y, Color fill, Color outline, Graphics g)

Here you can find the source of drawOutlinedString(String s, int x, int y, Color fill, Color outline, Graphics g)

Description

Draws basic nice looking outlined string

License

Open Source License

Parameter

Parameter Description
s a parameter
x a parameter
y a parameter
fill a parameter
outline a parameter
g a parameter

Declaration

public static void drawOutlinedString(String s, int x, int y, Color fill, Color outline, Graphics g) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Color;
import java.awt.Graphics;

public class Main {
    /**//from   ww w.j  a v  a  2  s.com
     * Draws basic nice looking outlined string
     * @param s
     * @param x
     * @param y
     * @param fill
     * @param outline
     * @param g
     */
    public static void drawOutlinedString(String s, int x, int y, Color fill, Color outline, Graphics g) {
        g.setColor(outline);
        g.drawString(s, x + 1, y - 1);
        g.drawString(s, x - 1, y + 1);
        g.drawString(s, x + 1, y - 1);
        g.drawString(s, x + 1, y + 1);
        g.setColor(fill);
        g.drawString(s, x, y);
    }
}

Related

  1. drawOutlinedStringSimple(Graphics2D g, String str, int x, int y)
  2. drawOutlineText(Graphics graphics, String text, Color textColor, int x, int y, Color outlineColor, int outlineWidth)
  3. drawStringWithOutline(final Graphics g, final String str, int x, int y, Color fillColor, Color outlineColor)
  4. drawStringOutline(Graphics g, String s, int x, int y, Color c, Color cOutLine)