code: public static void drawString(JComponent c, Graphics g, String text, int x, int y) {
          if (drawStringMethod != null) {
              try {
                  drawStringMethod.invoke(null,
                          c, g, text, Integer.valueOf(x), Integer.valueOf(y));
                  return;
              } catch (IllegalArgumentException e) {
                  // Use the BasicGraphicsUtils as fallback
              } catch (IllegalAccessException e) {
                  // Use the BasicGraphicsUtils as fallback
              } catch (InvocationTargetException e) {
                  // Use the BasicGraphicsUtils as fallback
              }
          }
          Graphics2D g2 = (Graphics2D) g;
          Map<?, ?> oldRenderingHints = installDesktopHints(g2);
          BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, -1, x, y);
          if (oldRenderingHints != null) {
              g2.addRenderingHints(oldRenderingHints);
          }
      }
docs: Draws the string at the specified location underlining the specified character.
  
  @param c JComponent that will display the string, may be null
  @param g Graphics to draw the text to
  @param text String to display
  @param x X coordinate to draw the text at
  @param y Y coordinate to draw the text at