code: public static void drawStringUnderlineCharAt(JComponent c, Graphics g,
              String text, int underlinedIndex, int x, int y) {
          if (drawStringUnderlineCharAtMethod != null) {
              try {
                  drawStringUnderlineCharAtMethod.invoke(null,
                          new Object[]{c, g, text, new Integer(underlinedIndex),
                              new Integer(x), new Integer(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, underlinedIndex, 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 underlinedIndex Index of a character in the string to underline
  @param x X coordinate to draw the text at
  @param y Y coordinate to draw the text at