Here you can find the source of drawStringAt(Graphics g, String t, int x, int y, int where)
Parameter | Description |
---|---|
g | _more_ |
t | _more_ |
x | _more_ |
y | _more_ |
where | _more_ |
public static void drawStringAt(Graphics g, String t, int x, int y, int where)
//package com.java2s; /**//w ww .j a v a 2s. co m * Copyright (c) 2008-2015 Geode Systems LLC * This Software is licensed under the Geode Systems RAMADDA License available in the source distribution in the file * ramadda_license.txt. The above copyright notice shall be included in all copies or substantial portions of the Software. */ import java.awt.*; public class Main { /** _more_ */ public static final int PT_NW = 1; /** _more_ */ public static final int PT_NE = 3; /** _more_ */ public static final int PT_SW = 7; /** _more_ */ public static final int PT_SE = 9; /** * _more_ * * @param g _more_ * @param t _more_ * @param x _more_ * @param y _more_ * @param where _more_ */ public static void drawStringAt(Graphics g, String t, int x, int y, int where) { FontMetrics fm = g.getFontMetrics(); int w = fm.stringWidth(t); int h = fm.getMaxAscent() + fm.getMaxDescent(); switch (where) { case PT_NW: g.drawString(t, x, y + h); break; case PT_NE: g.drawString(t, x - w, y + h); break; case PT_SW: g.drawString(t, x, y); break; case PT_SE: g.drawString(t, x - w, y); break; } } }