public void paintText(SynthContext ss,Graphics g,String text,int x,int y,int mnemonicIndex){
  if (text != null) {
    Graphics2D g2d=(Graphics2D)g.create();
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    JComponent c=ss.getComponent();
    FontMetrics fm=SwingUtilities2.getFontMetrics(c,g2d);
    y+=fm.getAscent();
    SwingUtilities2.drawString(c,g2d,text,x,y);
    if (mnemonicIndex >= 0 && mnemonicIndex < text.length()) {
      int underlineX=x + SwingUtilities2.stringWidth(c,fm,text.substring(0,mnemonicIndex));
      int underlineY=y;
      int underlineWidth=fm.charWidth(text.charAt(mnemonicIndex));
      int underlineHeight=1;
      g2d.fillRect(underlineX,underlineY + fm.getDescent() - 1,underlineWidth,underlineHeight);
    }
  }
}

public void paintText ( SynthContext ss , Graphics g , String text , int x , int y , int mnemonicIndex ) { if ( text != null ) { Graphics2D g2d = ( Graphics2D ) g . create ( ) ; g2d . setRenderingHint ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; JComponent c = ss . getComponent ( ) ; FontMetrics fm = SwingUtilities2 . getFontMetrics ( c , g2d ) ; y += fm . getAscent ( ) ; SwingUtilities2 . drawString ( c , g2d , text , x , y ) ; if ( mnemonicIndex >= 0 && mnemonicIndex < text . length ( ) ) { int underlineX = x + SwingUtilities2 . stringWidth ( c , fm , text . substring ( 0 , mnemonicIndex ) ) ; int underlineY = y ; int underlineWidth = fm . charWidth ( text . charAt ( mnemonicIndex ) ) ; int underlineHeight = 1 ; g2d . fillRect ( underlineX , underlineY + fm . getDescent ( ) - 1 , underlineWidth , underlineHeight ) ; } } }
paints text at the specified location . this will not attempt to render the text as html nor will it offset by the insets of the component .
