Java Graphics Draw drawChar(char c, int x, int y, Graphics g)

Here you can find the source of drawChar(char c, int x, int y, Graphics g)

Description

draw Char

License

Open Source License

Declaration

public static void drawChar(char c, int x, int y, Graphics g) 

Method Source Code

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

import java.awt.*;

import java.awt.image.*;

public class Main {
    private static BufferedImage[] GUI_GLYPH_CHARS;

    public static void drawChar(char c, int x, int y, Graphics g) {
        BufferedImage img = null;
        switch (c) {
        case ' ':
            img = GUI_GLYPH_CHARS[0];//  w ww  .ja va 2s  . com
            break;
        case '\u0263':
            img = GUI_GLYPH_CHARS[1];
            break;
        case '!':
            img = GUI_GLYPH_CHARS[33];
            break;
        case '"':
            img = GUI_GLYPH_CHARS[34];
            break;
        case '#':
            img = GUI_GLYPH_CHARS[35];
            break;
        case '$':
            img = GUI_GLYPH_CHARS[36];
            break;
        case '%':
            img = GUI_GLYPH_CHARS[37];
            break;
        case '&':
            img = GUI_GLYPH_CHARS[38];
            break;
        case '\'':
            img = GUI_GLYPH_CHARS[39];
            break;
        case '(':
            img = GUI_GLYPH_CHARS[40];
            break;
        case ')':
            img = GUI_GLYPH_CHARS[41];
            break;
        case '*':
            img = GUI_GLYPH_CHARS[42];
            break;
        case '+':
            img = GUI_GLYPH_CHARS[43];
            break;
        case ',':
            img = GUI_GLYPH_CHARS[44];
            break;
        case '-':
            img = GUI_GLYPH_CHARS[45];
            break;
        case '.':
            img = GUI_GLYPH_CHARS[46];
            break;
        case '/':
            img = GUI_GLYPH_CHARS[47];
            break;
        case '0':
            img = GUI_GLYPH_CHARS[48];
            break;
        case '1':
            img = GUI_GLYPH_CHARS[49];
            break;
        case '2':
            img = GUI_GLYPH_CHARS[50];
            break;
        case '3':
            img = GUI_GLYPH_CHARS[51];
            break;
        case '4':
            img = GUI_GLYPH_CHARS[52];
            break;
        case '5':
            img = GUI_GLYPH_CHARS[53];
            break;
        case '6':
            img = GUI_GLYPH_CHARS[54];
            break;
        case '7':
            img = GUI_GLYPH_CHARS[55];
            break;
        case '8':
            img = GUI_GLYPH_CHARS[56];
            break;
        case '9':
            img = GUI_GLYPH_CHARS[57];
            break;
        case ':':
            img = GUI_GLYPH_CHARS[58];
            break;
        }
        g.drawImage(img, x, y, null);
    }
}

Related

  1. drawBeamVariableRadiusVertical(Graphics g, Color c, int midx, int y1, int y2, int r1, int r2)
  2. drawBoundary(Graphics2D g2d, Rectangle bounds, Point2D.Double[] pts)
  3. drawBoxOrBlockChar(Graphics g, int x, int y, int bi, char c, int charWidth, int charHeight)
  4. drawBubbleHead(Graphics2D g, Point2D headPosition, double orientation, double size, Color color, Stroke stroke)
  5. drawBubbles(Graphics g, int nCode)
  6. drawChars(JComponent c, Graphics g, char[] data, int offset, int length, int x, int y)
  7. drawCheck(Graphics g, int x, int y)
  8. drawCheckerPattern(Graphics g_, int checkerSize)
  9. drawColors(Color[] colors, Graphics g, int x1, int y1, int x2, int y2, int direction)