code: public void drawEmphasizedText(Graphics g, Color foreground, Color emphasis, String s, int underlinedIndex, int x, int y) {
          Graphics2D g2d = (Graphics2D) g.create();
  
          g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  
          g2d.setColor(emphasis);
          BasicGraphicsUtils.drawStringUnderlineCharAt(g2d, s, underlinedIndex, x, y + 1);
          g2d.setColor(foreground);
          BasicGraphicsUtils.drawStringUnderlineCharAt(g2d, s, underlinedIndex, x, y);
      }
docs: Draw text with an emphasized background.
  
  @param g
  the Graphics context to draw with.
  @param foreground
  the foreground color.
  @param emphasis
  the emphasis color.
  @param s
  the text to draw.
  @param underlinedIndex
  the index to underline.
  @param x
  the x coordinate to draw at.
  @param y
  the y coordinate to draw at.