updateMetrics(); JTextComponent textComponent = (JTextComponent) getContainer();  g.setFont(textComponent.getFont()); selectedColor = textComponent.getSelectedTextColor(); unselectedColor = textComponent.getForeground(); disabledColor = textComponent.getDisabledTextColor();    selectedColor = Color.WHITE;
    public void paint(Graphics g, Shape s)    {      // Ensure metrics are up-to-date.      updateMetrics();      JTextComponent textComponent = (JTextComponent) getContainer();      g.setFont(textComponent.getFont());      selectedColor = textComponent.getSelectedTextColor();      unselectedColor = textComponent.getForeground();      disabledColor = textComponent.getDisabledTextColor();      // FIXME: this is a hack, for some reason textComponent.getSelectedColor      // was returning black, which is not visible against a black background      selectedColor = Color.WHITE;            Rectangle rect = s.getBounds();      int lineHeight = metrics.getHeight();      int end = getEndOffset();      int currStart = getStartOffset();      int currEnd;            while (currStart < end)        {          currEnd = calculateBreakPosition(currStart, end);          drawLine(currStart, currEnd, g, rect.x, rect.y + metrics.getAscent());          rect.y += lineHeight;                    if (currEnd == currStart)            currStart ++;          else            currStart = currEnd;                  }    }