Java Code Examples for java.awt.FontMetrics.getAscent()

The following are Jave code examples for showing how to use getAscent() of the java.awt.FontMetrics class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Progetto-C   File: UnicodeFont.java   View Source Code Vote up 7 votes
/**
 * Initialise the font to be used based on configuration
 * 
 * @param baseFont The AWT font to render
 * @param size The point size of the font to generated
 * @param bold True if the font should be rendered in bold typeface
 * @param italic True if the font should be rendered in bold typeface
 */
private void initializeFont(Font baseFont, int size, boolean bold, boolean italic) {
	Map attributes = baseFont.getAttributes();
	attributes.put(TextAttribute.SIZE, new Float(size));
	attributes.put(TextAttribute.WEIGHT, bold ? TextAttribute.WEIGHT_BOLD : TextAttribute.WEIGHT_REGULAR);
	attributes.put(TextAttribute.POSTURE, italic ? TextAttribute.POSTURE_OBLIQUE : TextAttribute.POSTURE_REGULAR);
	try {
		attributes.put(TextAttribute.class.getDeclaredField("KERNING").get(null), TextAttribute.class.getDeclaredField(
			"KERNING_ON").get(null));
	} catch (Exception ignored) {
	}
	font = baseFont.deriveFont(attributes);

	FontMetrics metrics = GlyphPage.getScratchGraphics().getFontMetrics(font);
	ascent = metrics.getAscent();
	descent = metrics.getDescent();
	leading = metrics.getLeading();
	
	// Determine width of space glyph (getGlyphPixelBounds gives a width of zero).
	char[] chars = " ".toCharArray();
	GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT);
	spaceWidth = vector.getGlyphLogicalBounds(0).getBounds().width;
}
 
Example 2
Project: openjdk-jdk10   File: MotifBorders.java   View Source Code Vote up 6 votes
/**
 * Reinitialize the insets parameter with this Border's current Insets.
 * @param c the component for which this border insets value applies
 * @param insets the object to be reinitialized
 */
public Insets getBorderInsets(Component c, Insets insets) {
    if (!(c instanceof JPopupMenu)) {
        return insets;
    }
    FontMetrics fm;
    int         descent = 0;
    int         ascent = 16;

    String title = ((JPopupMenu)c).getLabel();
    if (title == null) {
        insets.left = insets.top = insets.right = insets.bottom = 0;
        return insets;
    }

    fm = c.getFontMetrics(font);

    if(fm != null) {
        descent = fm.getDescent();
        ascent = fm.getAscent();
    }

    insets.top += ascent + descent + TEXT_SPACING + GROOVE_HEIGHT;
    return insets;
}
 
Example 3
Project: myster   File: ProgressWindow.java   View Source Code Vote up 6 votes
public void paintComponent(Graphics g) {
    if (ad == null)
        return;

    g.drawImage(ad, 0, 0, X_SIZE, AD_HEIGHT, this);

    if (!labelText.equals("")) {
        final int xPadding = 3;

        FontMetrics metrics = getFontMetrics(getFont());

        int descent = metrics.getDescent();
        int ascent = metrics.getAscent();
        int leading = metrics.getLeading();
        int height = metrics.getHeight();

        g.setColor(new Color(255, 255, 200));
        g.fillRect(0, 0, metrics.stringWidth(labelText) + xPadding + xPadding, height);

        g.setColor(Color.black);
        g.drawString(labelText, xPadding, ascent + leading / 2);
    }
}
 
Example 4
Project: OpenJSharp   File: CompositionArea.java   View Source Code Vote up 6 votes
private Rectangle getCaretRectangle(TextHitInfo caret) {
    int caretLocation = 0;
    TextLayout layout = composedTextLayout;
    if (layout != null) {
        caretLocation = Math.round(layout.getCaretInfo(caret)[0]);
    }
    Graphics g = getGraphics();
    FontMetrics metrics = null;
    try {
        metrics = g.getFontMetrics();
    } finally {
        g.dispose();
    }
    return new Rectangle(TEXT_ORIGIN_X + caretLocation,
                         TEXT_ORIGIN_Y - metrics.getAscent(),
                         0, metrics.getAscent() + metrics.getDescent());
}
 
Example 5
Project: jdk8u-jdk   File: MotifBorders.java   View Source Code Vote up 6 votes
/**
 * Reinitialize the insets parameter with this Border's current Insets.
 * @param c the component for which this border insets value applies
 * @param insets the object to be reinitialized
 */
public Insets getBorderInsets(Component c, Insets insets) {
    if (!(c instanceof JPopupMenu)) {
        return insets;
    }
    FontMetrics fm;
    int         descent = 0;
    int         ascent = 16;

    String title = ((JPopupMenu)c).getLabel();
    if (title == null) {
        insets.left = insets.top = insets.right = insets.bottom = 0;
        return insets;
    }

    fm = c.getFontMetrics(font);

    if(fm != null) {
        descent = fm.getDescent();
        ascent = fm.getAscent();
    }

    insets.top += ascent + descent + TEXT_SPACING + GROOVE_HEIGHT;
    return insets;
}
 
Example 6
Project: BaseClient   File: UnicodeFont.java   View Source Code Vote up 6 votes
/**
 * Initialise the font to be used based on configuration
 * 
 * @param baseFont The AWT font to render
 * @param size The point size of the font to generated
 * @param bold True if the font should be rendered in bold typeface
 * @param italic True if the font should be rendered in bold typeface
 */
private void initializeFont(Font baseFont, int size, boolean bold, boolean italic) {
	Map attributes = baseFont.getAttributes();
	attributes.put(TextAttribute.SIZE, new Float(size));
	attributes.put(TextAttribute.WEIGHT, bold ? TextAttribute.WEIGHT_BOLD : TextAttribute.WEIGHT_REGULAR);
	attributes.put(TextAttribute.POSTURE, italic ? TextAttribute.POSTURE_OBLIQUE : TextAttribute.POSTURE_REGULAR);
	try {
		attributes.put(TextAttribute.class.getDeclaredField("KERNING").get(null), TextAttribute.class.getDeclaredField(
			"KERNING_ON").get(null));
	} catch (Exception ignored) {
	}
	font = baseFont.deriveFont(attributes);

	FontMetrics metrics = GlyphPage.getScratchGraphics().getFontMetrics(font);
	ascent = metrics.getAscent();
	descent = metrics.getDescent();
	leading = metrics.getLeading();
	
	// Determine width of space glyph (getGlyphPixelBounds gives a width of zero).
	char[] chars = " ".toCharArray();
	GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT);
	spaceWidth = vector.getGlyphLogicalBounds(0).getBounds().width;
}
 
Example 7
Project: openjdk-jdk10   File: CompositionArea.java   View Source Code Vote up 6 votes
private Rectangle getCaretRectangle(TextHitInfo caret) {
    int caretLocation = 0;
    TextLayout layout = composedTextLayout;
    if (layout != null) {
        caretLocation = Math.round(layout.getCaretInfo(caret)[0]);
    }
    Graphics g = getGraphics();
    FontMetrics metrics = null;
    try {
        metrics = g.getFontMetrics();
    } finally {
        g.dispose();
    }
    return new Rectangle(TEXT_ORIGIN_X + caretLocation,
                         TEXT_ORIGIN_Y - metrics.getAscent(),
                         0, metrics.getAscent() + metrics.getDescent());
}
 
Example 8
Project: litiengine   File: GuiComponent.java   View Source Code Vote up 5 votes
private void renderText(Graphics2D g) {
  if (this.getText() == null || this.getText().isEmpty()) {
    return;
  }

  final FontMetrics fm = g.getFontMetrics();

  double defaultTextX;
  double defaultTextY = fm.getAscent() + (this.getHeight() - (fm.getAscent() + fm.getDescent())) / 2;
  switch (this.getTextAlign()) {
  case LEFT:
    defaultTextX = this.getTextXMargin();
    break;
  case RIGHT:
    defaultTextX = this.getWidth() - this.getTextXMargin() - fm.stringWidth(this.getTextToRender(g));
    break;
  case CENTER:
  default:
    defaultTextX = this.getWidth() / 2 - fm.stringWidth(this.getTextToRender(g)) / 2.0;
    break;
  }
  if (this.getTextY() == 0) {
    this.setTextY(defaultTextY);
  }

  if (this.getTextX() == 0) {
    this.setTextX(defaultTextX);
  }
  if (this.getTextAngle() == 0) {
    if (this.drawTextShadow()) {
      RenderEngine.drawTextWithShadow(g, this.getTextToRender(g), this.getX() + this.getTextX(), this.getY() + this.getTextY(), this.getTextShadowColor());
    } else {
      RenderEngine.drawText(g, this.getTextToRender(g), this.getX() + this.getTextX(), this.getY() + this.getTextY());
    }
  } else if (this.getTextAngle() == 90) {
    RenderEngine.drawRotatedText(g, this.getX() + this.getTextX(), this.getY() + this.getTextY() - fm.stringWidth(this.getTextToRender(g)), this.getTextAngle(), this.getTextToRender(g));
  } else {
    RenderEngine.drawRotatedText(g, this.getX() + this.getTextX(), this.getY() + this.getTextY(), this.getTextAngle(), this.getTextToRender(g));
  }
}
 
Example 9
Project: incubator-netbeans   File: AquaViewTabDisplayerUI.java   View Source Code Vote up 5 votes
@Override
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            21 : fm.getAscent() + 2 * fm.getDescent() + 3;
    height += 1; //align with editor tabs
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
 
Example 10
Project: incubator-netbeans   File: WinClassicViewTabDisplayerUI.java   View Source Code Vote up 5 votes
@Override
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            19 : fm.getAscent() + 2 * fm.getDescent() + 2;
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
 
Example 11
Project: incubator-netbeans   File: MetalViewTabDisplayerUI.java   View Source Code Vote up 5 votes
@Override
public Dimension getPreferredSize(JComponent c) {
    FontMetrics fm = getTxtFontMetrics();
    int height = fm == null ?
            21 : fm.getAscent() + 2 * fm.getDescent() + 4;
    Insets insets = c.getInsets();
    prefSize.height = height + insets.bottom + insets.top;
    return prefSize;
}
 
Example 12
Project: incubator-netbeans   File: FoldingSideBar.java   View Source Code Vote up 5 votes
@Override
public void paintComponent(Graphics g) {
    Rectangle cp = g.getClipBounds();
    g.setColor(getBackground());
    g.fillRect(cp.x, cp.y, cp.width, cp.height);
    if (lines == null) {
        return;
    }
    g.setColor(getForeground());
    FontMetrics fontMetrics = textView.getFontMetrics(textView.getFont());
    int lineHeight = fontMetrics.getHeight();
    int descent = fontMetrics.getDescent();
    int offset = 0;
    try {
        Rectangle modelToView = textView.modelToView(0);
        offset = modelToView == null ? 0 : modelToView.y;
    } catch (BadLocationException ex) {
        LOG.log(Level.INFO, null, ex);
    }
    offset += lineHeight - fontMetrics.getAscent();

    int size = lines.getLineCount();
    int logLine = 0; // logical line (including wrapped lines)
    int nextLogLine;
    int firstVisibleLine = Math.max(0, getLineAtPosition(cp.y) - 1);
    int lastVisibleLine = getLastVisibleLine(cp, size);
    for (int i = firstVisibleLine; i < lastVisibleLine; i++) {
        if (!lines.isVisible(i)) {
            continue;
        }
        nextLogLine = findLogicalLineIndex(findNextVisibleLine(i), size);
        drawLineGraphics(g, i, logLine, nextLogLine, offset, lineHeight,
                descent);
        logLine = nextLogLine;
    }
}
 
Example 13
Project: VASSAL-src   File: LOS_Thread.java   View Source Code Vote up 5 votes
/**
 * Writes text showing the range
 *
 * @param range the range to display, in whatever units returned
 * by the {@link MapGrid} containing the thread */
public void drawRange(Graphics g, int range) {
  Point mapArrow = map.componentCoordinates(arrow);
  Point mapAnchor = map.componentCoordinates(anchor);
  g.setColor(Color.black);
  g.setFont(RANGE_FONT);
  final FontMetrics fm = g.getFontMetrics();
  final StringBuilder buffer = new StringBuilder();
  int dummy = range;
  while (dummy >= 1) {
    dummy = dummy / 10;
    buffer.append("8");
  }
  if (buffer.length() == 0) {
    buffer.append("8");
  }
  String rangeMess = Resources.getString("LOS_Thread.range");
  int wid = fm.stringWidth(" "+rangeMess+"  "+buffer.toString());
  int hgt = fm.getAscent() + 2;
  int w = mapArrow.x - mapAnchor.x;
  int h = mapArrow.y - mapAnchor.y;
  int x0 = mapArrow.x + (int) ((wid / 2 + 20) * w / Math.sqrt(w * w + h * h));
  int y0 = mapArrow.y + (int) ((hgt / 2 + 20) * h / Math.sqrt(w * w + h * h));
  g.fillRect(x0 - wid / 2, y0 + hgt / 2 - fm.getAscent(), wid, hgt);
  g.setColor(Color.white);
  g.drawString(rangeMess + " " + range,
               x0 - wid / 2 + fm.stringWidth(" "), y0 + hgt / 2);
  lastRangeRect = new Rectangle(x0 - wid / 2, y0 + hgt / 2 - fm.getAscent(), wid+1, hgt+1);
  Point np = map.mapCoordinates(new Point(lastRangeRect.x, lastRangeRect.y));
  lastRangeRect.x = np.x;
  lastRangeRect.y = np.y;
  lastRange = String.valueOf(range);
}
 
Example 14
Project: Logisim   File: TextFieldCaret.java   View Source Code Vote up 5 votes
@Override
public Bounds getBounds(Graphics g) {
	int x = field.getX();
	int y = field.getY();
	Font font = field.getFont();
	FontMetrics fm;
	if (font == null)
		fm = g.getFontMetrics();
	else
		fm = g.getFontMetrics(font);
	int width = fm.stringWidth(curText);
	int ascent = fm.getAscent();
	int descent = fm.getDescent();
	int height = ascent + descent;
	switch (field.getHAlign()) {
	case TextField.H_CENTER:
		x -= width / 2;
		break;
	case TextField.H_RIGHT:
		x -= width;
		break;
	default:
		break;
	}
	switch (field.getVAlign()) {
	case TextField.V_TOP:
		y += ascent;
		break;
	case TextField.V_CENTER:
		y += (ascent - descent) / 2;
		break;
	case TextField.V_BOTTOM:
		y -= descent;
		break;
	default:
		break;
	}
	return Bounds.create(x, y - ascent, width, height).add(field.getBounds(g)).expand(3);
}
 
Example 15
Project: open-rmbt   File: ImageExport.java   View Source Code Vote up 4 votes
protected void drawCenteredString(String s, int x, int y, int w, int h, Graphics g) {
     FontMetrics fm = g.getFontMetrics();
     x += (w - fm.stringWidth(s)) / 2;
     y += (fm.getAscent() + (h - (fm.getAscent() + fm.getDescent())) / 2);
     g.drawString(s, x, y);
}
 
Example 16
Project: jdk8u-jdk   File: SynthLabelUI.java   View Source Code Vote up 4 votes
/**
 * {@inheritDoc}
 */
@Override
public int getBaseline(JComponent c, int width, int height) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    if (width < 0 || height < 0) {
        throw new IllegalArgumentException(
                "Width and height must be >= 0");
    }
    JLabel label = (JLabel)c;
    String text = label.getText();
    if (text == null || "".equals(text)) {
        return -1;
    }
    Insets i = label.getInsets();
    Rectangle viewRect = new Rectangle();
    Rectangle textRect = new Rectangle();
    Rectangle iconRect = new Rectangle();
    viewRect.x = i.left;
    viewRect.y = i.top;
    viewRect.width = width - (i.right + viewRect.x);
    viewRect.height = height - (i.bottom + viewRect.y);

    // layout the text and icon
    SynthContext context = getContext(label);
    FontMetrics fm = context.getComponent().getFontMetrics(
        context.getStyle().getFont(context));
    context.getStyle().getGraphicsUtils(context).layoutText(
        context, fm, label.getText(), label.getIcon(),
        label.getHorizontalAlignment(), label.getVerticalAlignment(),
        label.getHorizontalTextPosition(), label.getVerticalTextPosition(),
        viewRect, iconRect, textRect, label.getIconTextGap());
    View view = (View)label.getClientProperty(BasicHTML.propertyKey);
    int baseline;
    if (view != null) {
        baseline = BasicHTML.getHTMLBaseline(view, textRect.width,
                                             textRect.height);
        if (baseline >= 0) {
            baseline += textRect.y;
        }
    }
    else {
        baseline = textRect.y + fm.getAscent();
    }
    context.dispose();
    return baseline;
}
 
Example 17
Project: OpenJSharp   File: MotifGraphicsUtils.java   View Source Code Vote up 4 votes
static void drawStringInRect(JComponent c, Graphics g, String aString,
                                 int x, int y, int width, int height,
                                 int justification) {
        FontMetrics  fontMetrics;
        int          drawWidth, startX, startY, delta;

        if (g.getFont() == null) {
//            throw new InconsistencyException("No font set");
            return;
        }
        fontMetrics = SwingUtilities2.getFontMetrics(c, g);
        if (fontMetrics == null) {
//            throw new InconsistencyException("No metrics for Font " + font());
            return;
        }

        if (justification == CENTER) {
            drawWidth = SwingUtilities2.stringWidth(c, fontMetrics, aString);
            if (drawWidth > width) {
                drawWidth = width;
            }
            startX = x + (width - drawWidth) / 2;
        } else if (justification == RIGHT) {
            drawWidth = SwingUtilities2.stringWidth(c, fontMetrics, aString);
            if (drawWidth > width) {
                drawWidth = width;
            }
            startX = x + width - drawWidth;
        } else {
            startX = x;
        }

        delta = (height - fontMetrics.getAscent() - fontMetrics.getDescent()) / 2;
        if (delta < 0) {
            delta = 0;
        }

        startY = y + height - delta - fontMetrics.getDescent();

        SwingUtilities2.drawString(c, g, aString, startX, startY);
    }
 
Example 18
Project: OpenJSharp   File: SynthLabelUI.java   View Source Code Vote up 4 votes
/**
 * {@inheritDoc}
 */
@Override
public int getBaseline(JComponent c, int width, int height) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    if (width < 0 || height < 0) {
        throw new IllegalArgumentException(
                "Width and height must be >= 0");
    }
    JLabel label = (JLabel)c;
    String text = label.getText();
    if (text == null || "".equals(text)) {
        return -1;
    }
    Insets i = label.getInsets();
    Rectangle viewRect = new Rectangle();
    Rectangle textRect = new Rectangle();
    Rectangle iconRect = new Rectangle();
    viewRect.x = i.left;
    viewRect.y = i.top;
    viewRect.width = width - (i.right + viewRect.x);
    viewRect.height = height - (i.bottom + viewRect.y);

    // layout the text and icon
    SynthContext context = getContext(label);
    FontMetrics fm = context.getComponent().getFontMetrics(
        context.getStyle().getFont(context));
    context.getStyle().getGraphicsUtils(context).layoutText(
        context, fm, label.getText(), label.getIcon(),
        label.getHorizontalAlignment(), label.getVerticalAlignment(),
        label.getHorizontalTextPosition(), label.getVerticalTextPosition(),
        viewRect, iconRect, textRect, label.getIconTextGap());
    View view = (View)label.getClientProperty(BasicHTML.propertyKey);
    int baseline;
    if (view != null) {
        baseline = BasicHTML.getHTMLBaseline(view, textRect.width,
                                             textRect.height);
        if (baseline >= 0) {
            baseline += textRect.y;
        }
    }
    else {
        baseline = textRect.y + fm.getAscent();
    }
    context.dispose();
    return baseline;
}
 
Example 19
Project: SE2017-Team1   File: TestUtil.java   View Source Code Vote up 4 votes
public static void drawAct(Graphics2D g2d, Point center, String title, String bodyText,
		boolean isExec, boolean isPend, boolean isPetri) {
	
	int leftX = center.x - Constants.ACTIVITY_WIDTH / 2;
	int rightX = center.x + Constants.ACTIVITY_WIDTH /2;
	int upperY = center.y - Constants.ACTIVITY_HEIGHT / 2;
	int lineY = upperY + Constants.HEADER_HEIGHT;
	
    // border
	g2d.setColor(Constants.ACTIVITY_BACKGROUND_COLOR);
	g2d.fillRect(leftX, upperY, Constants.ACTIVITY_WIDTH, Constants.ACTIVITY_HEIGHT);
	g2d.setColor(Color.BLACK);
	g2d.drawRect(leftX, upperY, Constants.ACTIVITY_WIDTH, Constants.ACTIVITY_HEIGHT);
	g2d.drawLine(leftX, lineY, rightX, lineY);
	
	// font
	g2d.setFont(Constants.BASIC_FONT);
	FontMetrics metrics = g2d.getFontMetrics(g2d.getFont());
	
	// title
    int xTitle = leftX + (Constants.ACTIVITY_WIDTH - metrics.stringWidth(title)) / 2;
    int yTitle = upperY + ((Constants.HEADER_HEIGHT - metrics.getHeight()) / 2) + metrics.getAscent();
    g2d.drawString(title, xTitle, yTitle);
	  
    // body text
    int xBody = leftX + (Constants.ACTIVITY_WIDTH - metrics.stringWidth(bodyText)) / 2;
    int yBody = upperY + Constants.LINE_HEIGHT + Constants.HEADER_HEIGHT + 9 + g2d.getFontMetrics().getHeight();
    g2d.drawString(bodyText, xBody, yBody);
    
    // checkmark
    if (isExec) {
    	g2d.setFont(Constants.CHECKMARK_FONT);
	    g2d.setColor(Constants.CHECKMARK_COLOR);
	    int xCheck = leftX + Constants.PETRI_MARGIN;
	    int yCheck = upperY + Constants.HEADER_HEIGHT + 20;
	    g2d.drawString(Constants.CHECKMARK_SYMB, xCheck, yCheck);
    }
    
    // exclamation mark
    if (isPend) {
    	g2d.setFont(Constants.EXCLAMATION_FONT);
	    g2d.setColor(Constants.EXCLAMATION_COLOR);
	    int xExclam = rightX - Constants.PETRI_MARGIN - 10;
	    int yExclam = upperY + Constants.HEADER_HEIGHT + 20;
	    g2d.drawString(Constants.EXCLAMATION_SYMB, xExclam, yExclam);
    }
    
    // Petri
    if (isPetri) {
    	g2d.setColor(Color.BLACK);
	    g2d.setFont(Constants.BASIC_FONT);
	    g2d.drawRect(leftX + Constants.PETRI_MARGIN, lineY + Constants.PETRI_MARGIN,
			Constants.ACTIVITY_WIDTH - 2 * Constants.PETRI_MARGIN, Constants.ACTIVITY_HEIGHT - Constants.HEADER_HEIGHT - 2 * Constants.PETRI_MARGIN);
    } 
}
 
Example 20
Project: Logisim   File: TextField.java   View Source Code Vote up 4 votes
public void draw(Graphics g) {
	Font oldFont = g.getFont();
	Color oldColor = g.getColor();
	if (font != null)
		g.setFont(font);
	if (color != null)
		g.setColor(color);
	int x = this.x;
	int y = this.y;
	FontMetrics fm = g.getFontMetrics();
	int width = fm.stringWidth(text);
	int ascent = fm.getAscent();
	int descent = fm.getDescent();
	switch (halign) {
	case TextField.H_CENTER:
		x -= width / 2;
		break;
	case TextField.H_RIGHT:
		x -= width;
		break;
	default:
		break;
	}
	switch (valign) {
	case TextField.V_TOP:
		y += ascent;
		break;
	case TextField.V_CENTER:
		y += ascent / 2;
		break;
	case TextField.V_CENTER_OVERALL:
		y += (ascent - descent) / 2;
		break;
	case TextField.V_BOTTOM:
		y -= descent;
		break;
	default:
		break;
	}
	g.drawString(text, x, y);
	g.setFont(oldFont);
	g.setColor(oldColor);
}