@Override
    protected void paintComponent(Graphics g) {
        String text = getText();
        if (text == null) {
            text = "";
        }

        StringBuilder styleBuilder = new StringBuilder();
        appendStyle(styleBuilder, getNormalStyle());
        if (model.isRollover()) {
            appendStyle(styleBuilder, getHoveredStyle());
        }
        if (visited) {
            appendStyle(styleBuilder, getVisitedStyle());
        }

        String newStyledText = String.format(
                "<html><div style=\"%s\">%s</div>", styleBuilder, text);
        if (!newStyledText.equals(styledText)) {
            styledText = newStyledText;
            BasicHTML.updateRenderer(this, styledText);
        } else {
            super.paintComponent(g);
        }
    }