protected void paintTextLines(Graphics g, JLabel label, FontMetrics fm) {
        List<String> lines = getTextLines(label);

        // Available component height to paint on.
        int height = getAvailableHeight(label);

        int textHeight = lines.size() * fm.getHeight();
        while (textHeight > height) {
            // Remove one line until no. of visible lines is found.
            textHeight -= fm.getHeight();
        }
        paintTextR.height = Math.min(textHeight, height);
        paintTextR.y = alignmentY(label, fm, paintTextR);

        int textX = paintTextR.x;
        int textY = paintTextR.y;

        for (Iterator<String> it = lines.iterator(); it.hasNext()
                && paintTextR.contains(textX, textY + getAscent(fm)); textY += fm
                .getHeight()) {

            String text = it.next().trim();

            if (it.hasNext()
                    && !paintTextR.contains(textX, textY + fm.getHeight()
                            + getAscent(fm))) {
                // The last visible row, add a clip indication.
                text = clip(text, fm, paintTextR);
            }

            int x = alignmentX(label, fm, text, paintTextR);

            if (label.isEnabled()) {
                paintEnabledText(label, g, text, x, textY);
            } else {
                paintDisabledText(label, g, text, x, textY);
            }
        }
    }