Java Code Examples for org.pushingpixels.substance.api.SubstanceSkin#getBackgroundColorScheme()

The following examples show how to use org.pushingpixels.substance.api.SubstanceSkin#getBackgroundColorScheme() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SubstanceRibbonBandUI.java    From radiance with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private ResizableIcon getExpandButtonIcon(final SubstanceSkin skin,
        final AbstractCommandButton button) {
    final int fontSize = SubstanceSizeUtils.getComponentFontSize(button);
    int arrowIconWidth = (int) SubstanceSizeUtils.getSmallArrowIconWidth(fontSize);
    int arrowIconHeight = (int) SubstanceSizeUtils.getSmallDoubleArrowIconHeight(fontSize);
    final ResizableIcon arrowIcon = new TransitionAwareResizableIcon(button,
            () -> ((ActionPopupTransitionAwareUI) button.getUI()).getActionTransitionTracker(),
            (SubstanceColorScheme scheme, int width, int height) -> {
                SubstanceColorScheme bgColorScheme = skin
                        .getBackgroundColorScheme(DecorationAreaType.GENERAL);
                Color bgFillColor = bgColorScheme.getBackgroundFillColor();
                return SubstanceImageCreator.getDoubleArrowIcon(
                        width, height,
                        SubstanceSizeUtils.getSmallDoubleArrowGap(fontSize),
                        SubstanceSizeUtils.getDoubleArrowStrokeWidth(fontSize),
                        ribbonBand.getComponentOrientation().isLeftToRight()
                                ? SwingConstants.EAST : SwingConstants.WEST,
                        SubstanceColorSchemeUtilities.getShiftedScheme(scheme, bgFillColor,
                                0.0f, bgFillColor, 0.3f));
            }, new Dimension(arrowIconHeight, arrowIconWidth));
    return arrowIcon;
}
 
Example 2
Source File: TopLineOverlayPainter.java    From radiance with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void paintOverlay(Graphics2D graphics, Component comp,
		DecorationAreaType decorationAreaType, int width, int height,
		SubstanceSkin skin) {
	Component topMostWithSameDecorationAreaType = SubstanceCoreUtilities
			.getTopMostParentWithDecorationAreaType(comp,
					decorationAreaType);

	Point inTopMost = SwingUtilities.convertPoint(comp, new Point(0, 0),
			topMostWithSameDecorationAreaType);
	int dy = inTopMost.y;

	float borderStrokeWidth = SubstanceSizeUtils.getBorderStrokeWidth();
	graphics.setStroke(new BasicStroke(borderStrokeWidth));

	SubstanceColorScheme colorScheme = skin
			.getBackgroundColorScheme(decorationAreaType);
	graphics.setColor(this.colorSchemeQuery.query(colorScheme));
	float topY = borderStrokeWidth - dy;
	Line2D.Float line = new Line2D.Float(0, topY, width, topY);
	graphics.draw(line);
}
 
Example 3
Source File: ImageWrapperDecorationPainter.java    From radiance with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Paints the title background.
 * 
 * @param graphics
 *            Graphics context.
 * @param comp
 *            Component.
 * @param decorationAreaType
 *            Decoration area type. Must not be <code>null</code>.
 * @param width
 *            Width.
 * @param height
 *            Height.
 * @param skin
 *            Skin for painting the title background.
 */
private void paintTitleBackground(Graphics2D graphics, Component comp,
        DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) {

    SubstanceColorScheme tileScheme = skin.getBackgroundColorScheme(decorationAreaType);
    if (this.baseDecorationPainter == null) {
        graphics.setColor(tileScheme.getMidColor());
        graphics.fillRect(0, 0, width, height);
    } else {
        this.baseDecorationPainter.paintDecorationArea(graphics, comp, decorationAreaType,
                width, height, skin);
    }

    Graphics2D temp = (Graphics2D) graphics.create();
    this.tileArea(temp, comp, tileScheme, 0, 0, width, height);
    temp.dispose();
}
 
Example 4
Source File: ImageWrapperDecorationPainter.java    From radiance with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Paints the background of non-title decoration areas.
 * 
 * @param graphics
 *            Graphics context.
 * @param comp
 *            Component.
 * @param decorationAreaType
 *            Decoration area type. Must not be <code>null</code>.
 * @param width
 *            Width.
 * @param height
 *            Height.
 * @param skin
 *            Skin for painting the background of non-title decoration areas.
 */
private void paintExtraBackground(Graphics2D graphics, Component comp,
        DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) {
    Point offset = SubstanceCoreUtilities.getOffsetInRootPaneCoords(comp);

    SubstanceColorScheme tileScheme = skin.getBackgroundColorScheme(decorationAreaType);
    if (this.baseDecorationPainter != null) {
        this.baseDecorationPainter.paintDecorationArea(graphics, comp, decorationAreaType,
                width, height, skin);
    } else {
        graphics.setColor(tileScheme.getMidColor());
        graphics.fillRect(0, 0, width, height);
    }
    Graphics2D temp = (Graphics2D) graphics.create();
    this.tileArea(temp, comp, tileScheme, offset.x, offset.y, width, height);
    temp.dispose();
}
 
Example 5
Source File: ClassicDecorationPainter.java    From radiance with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void paintDecorationArea(Graphics2D graphics, Component comp,
		DecorationAreaType decorationAreaType, int width, int height,
		SubstanceSkin skin) {
	SubstanceColorScheme scheme = skin.getBackgroundColorScheme(decorationAreaType);
	if (width * height < 100000) {
		HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
				scheme.getDisplayName());
		BufferedImage result = smallImageCache.get(key);
		if (result == null) {
			result = SubstanceCoreUtilities.getBlankImage(width, height);
			this.internalPaint((Graphics2D) result.getGraphics(), comp, width, height, scheme);
			smallImageCache.put(key, result);
		}
		NeonCortex.drawImage(graphics, result, 0, 0);
		return;
	}

	this.internalPaint(graphics, comp, width, height, scheme);
}
 
Example 6
Source File: TopBezelOverlayPainter.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void paintOverlay(Graphics2D graphics, Component comp,
		DecorationAreaType decorationAreaType, int width, int height,
		SubstanceSkin skin) {
	Component topMostWithSameDecorationAreaType = SubstanceCoreUtilities
			.getTopMostParentWithDecorationAreaType(comp,
					decorationAreaType);

	Point inTopMost = SwingUtilities.convertPoint(comp, new Point(0, 0),
			topMostWithSameDecorationAreaType);
	int dy = inTopMost.y;

	float borderStrokeWidth = SubstanceSizeUtils.getBorderStrokeWidth();
	graphics.setStroke(new BasicStroke(borderStrokeWidth));

	SubstanceColorScheme colorScheme = skin
			.getBackgroundColorScheme(decorationAreaType);
	graphics.setColor(this.colorSchemeQueryTop.query(colorScheme));
	float topY = - dy;
	Line2D.Float topLine = new Line2D.Float(0, topY, width, topY);
	graphics.draw(topLine);

	graphics.setColor(this.colorSchemeQueryBottom.query(colorScheme));
	float bezelY = borderStrokeWidth - dy;
	Line2D.Float bezelLine = new Line2D.Float(0, bezelY, width, bezelY);
	graphics.draw(bezelLine);
}
 
Example 7
Source File: BottomLineOverlayPainter.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void paintOverlay(Graphics2D graphics, Component comp,
		DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) {
	Component topMostWithSameDecorationAreaType = SubstanceCoreUtilities
			.getTopMostParentWithDecorationAreaType(comp, decorationAreaType);

	float borderStrokeWidth = SubstanceSizeUtils.getBorderStrokeWidth();
	graphics.setStroke(new BasicStroke(borderStrokeWidth));

	SubstanceColorScheme colorScheme = skin.getBackgroundColorScheme(decorationAreaType);
	graphics.setColor(this.colorSchemeQuery.query(colorScheme));
	float bottomY = topMostWithSameDecorationAreaType.getHeight() - borderStrokeWidth;
	Line2D.Float line = new Line2D.Float(0, bottomY, width, bottomY);
	graphics.draw(line);
}
 
Example 8
Source File: FractionBasedDecorationPainter.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void paintDecorationArea(Graphics2D graphics, Component comp,
		DecorationAreaType decorationAreaType, int width, int height,
		SubstanceSkin skin) {
    SubstanceColorScheme colorScheme = skin.getBackgroundColorScheme(decorationAreaType);
	if (this.decoratedAreas.contains(decorationAreaType)) {
		this.paintDecoratedBackground(graphics, comp, decorationAreaType,
				width, height, colorScheme);
	} else {
		this.paintSolidBackground(graphics, width, height, colorScheme);
	}
}
 
Example 9
Source File: MatteDecorationPainter.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void paintDecorationArea(Graphics2D graphics, Component comp,
        DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) {
    SubstanceColorScheme colorScheme = skin.getBackgroundColorScheme(decorationAreaType);
    if ((decorationAreaType == DecorationAreaType.PRIMARY_TITLE_PANE)
            || (decorationAreaType == DecorationAreaType.SECONDARY_TITLE_PANE)) {
        this.paintTitleBackground(graphics, width, height, colorScheme);
    } else {
        this.paintExtraBackground(graphics, comp, width, height, colorScheme);
    }
}
 
Example 10
Source File: Glass3DDecorationPainter.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void paintDecorationArea(Graphics2D graphics, Component comp,
        DecorationAreaType decorationAreaType, int width, int height,
        SubstanceSkin skin) {
    SubstanceColorScheme colorScheme = skin.getBackgroundColorScheme(decorationAreaType);
    LinearGradientPaint paint = new LinearGradientPaint(0, 0, 0, height,
            new float[] { 0.0f, 0.4f, 0.5f, 1.0f },
            new Color[] { colorScheme.getUltraLightColor(), colorScheme.getLightColor(),
                    colorScheme.getMidColor(), colorScheme.getUltraLightColor() },
            MultipleGradientPaint.CycleMethod.REPEAT);
    graphics.setPaint(paint);
    graphics.fillRect(0, 0, width, height);
}
 
Example 11
Source File: SubstanceRibbonBandUI.java    From radiance with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void paintBandTitle(Graphics graphics, Rectangle titleRectangle, String title) {
    // fix for issue 28 - empty ribbon band
    if (titleRectangle.width <= 0)
        return;

    Graphics2D g2d = (Graphics2D) graphics.create();
    Font controlFont = SubstanceCortex.GlobalScope.getFontPolicy().getFontSet()
            .getControlFont();
    g2d.setFont(controlFont.deriveFont(controlFont.getSize2D() - 1.0f));

    FontMetrics fm = graphics.getFontMetrics();

    int currLength = (int) fm.getStringBounds(title, g2d).getWidth();
    String titleToPaint = title;
    while (currLength > titleRectangle.width) {
        title = title.substring(0, title.length() - 1);
        titleToPaint = title + "...";
        currLength = (int) fm.getStringBounds(titleToPaint, g2d).getWidth();
    }

    SubstanceSkin skin = SubstanceCoreUtilities.getSkin(this.ribbonBand);

    // compute the FG color for the ribbon band
    // SubstanceColorScheme fgColorScheme = skin.getColorScheme(
    // this.expandButton, ComponentState.ENABLED);

    // make the title color blend a little with the background
    SubstanceColorScheme bgColorScheme = skin
            .getBackgroundColorScheme(DecorationAreaType.GENERAL);
    Color bgFillColor = bgColorScheme.getBackgroundFillColor();
    Color fgColor = bgColorScheme.getForegroundColor();
    fgColor = SubstanceColorUtilities.getInterpolatedColor(fgColor, bgFillColor, 0.95f);

    g2d.setColor(fgColor);

    // restrict the title rectangle so that it's painted centered
    int deltaX = (titleRectangle.width - currLength) / 2;
    int deltaY = (titleRectangle.height - fm.getAscent() - fm.getDescent()) / 2;
    Rectangle smallTitleRectangle = new Rectangle(titleRectangle.x + deltaX,
            titleRectangle.y + deltaY, titleRectangle.width - 2 * deltaX,
            titleRectangle.height - 2 * deltaY);
    SubstanceTextUtilities.paintText(g2d, this.ribbonBand, smallTitleRectangle, titleToPaint,
            -1, g2d.getFont(), g2d.getColor(), g2d.getClipBounds());

    g2d.dispose();
}
 
Example 12
Source File: SubstanceRibbonTaskToggleButtonUI.java    From radiance with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static Color getForegroundColor(AbstractCommandButton button,
            StateTransitionTracker.ModelStateInfo modelStateInfo) {
        ComponentState currStateIgnoreSelection =
                ComponentState.getState(button.getActionModel(), button, true);
        ComponentState currState = ComponentState.getState(button.getActionModel(), button, false);
        Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates =
                modelStateInfo.getStateNoSelectionContributionMap();

        SubstanceColorScheme buttonFillScheme = SubstanceColorSchemeUtilities.getColorScheme(
                button, ColorSchemeAssociationKind.FILL, currStateIgnoreSelection);
        SubstanceSkin skin = SubstanceCoreUtilities.getSkin(button);
        SubstanceSlices.DecorationAreaType parentDecorationAreaType =
                SubstanceCortex.ComponentOrParentChainScope.getDecorationType(button.getParent());
        SubstanceColorScheme parentFillScheme = skin.getBackgroundColorScheme(parentDecorationAreaType);

        if (currState.isDisabled() || (activeStates == null) || (activeStates.size() == 1)) {
            SubstanceColorScheme schemeForCurrState = (currState == ComponentState.ENABLED)
                    ? parentFillScheme : buttonFillScheme;
//            System.out.println("For " + button.getText() + " state is " + currState +
//                    " and scheme is " + schemeForCurrState.getDisplayName() +
//                    " -> " + schemeForCurrState.getForegroundColor());
            return schemeForCurrState.getForegroundColor();
        }

        float aggrRed = 0;
        float aggrGreen = 0;
        float aggrBlue = 0;
//        System.out.println(
//                "For " + button.getText() + " in " + currState + ":" + currStateIgnoreSelection);
        for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry :
                activeStates.entrySet()) {
            ComponentState activeState = activeEntry.getKey();
            float alpha = activeEntry.getValue().getContribution();

            boolean correspondsToParentFill = (activeState == ComponentState.ENABLED) &&
                    !button.getActionModel().isSelected();
            SubstanceColorScheme activeColorScheme =
                    SubstanceColorSchemeUtilities.getColorScheme(button,
                            ColorSchemeAssociationKind.FILL, activeState);
            //System.out.println("\t" + activeState + " : " + currState);
            Color activeForeground = correspondsToParentFill
                    ? parentFillScheme.getForegroundColor()
                    : activeColorScheme.getForegroundColor();

//            System.out.println("\t" + activeState + " at alpha " + alpha + " from " +
//                    (correspondsToParentFill ? parentFillScheme :
//                            activeColorScheme).getDisplayName()
//                    + "[" + correspondsToParentFill + "] contributes color " +
//                    activeForeground);
            aggrRed += alpha * activeForeground.getRed();
            aggrGreen += alpha * activeForeground.getGreen();
            aggrBlue += alpha * activeForeground.getBlue();
        }
        return new Color((int) aggrRed, (int) aggrGreen, (int) aggrBlue);
    }
 
Example 13
Source File: SubstanceTitlePane.java    From radiance with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void paintComponent(Graphics g) {
    // long start = System.nanoTime();
    // As state isn't bound, we need a convenience place to check
    // if it has changed. Changing the state typically changes the
    if (this.getFrame() != null) {
        this.setState(this.getFrame().getExtendedState());
    }

    if (this.isControlOnlyMode) {
        return;
    }

    final JRootPane rootPane = this.getRootPane();
    boolean leftToRight = (this.window == null)
            ? rootPane.getComponentOrientation().isLeftToRight()
            : this.window.getComponentOrientation().isLeftToRight();
    int width = this.getWidth();
    int height = this.getHeight();

    SubstanceSkin skin = SubstanceCoreUtilities.getSkin(rootPane);
    if (skin == null) {
        SubstanceCoreUtilities.traceSubstanceApiUsage(this,
                "Substance delegate used when Substance is not the current LAF");
    }
    SubstanceColorScheme scheme = skin
            .getEnabledColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE);

    String theTitle = this.getTitle();
    String displayTitle = getDisplayTitle();

    Graphics2D graphics = (Graphics2D) g.create();
    BackgroundPaintingUtils.update(graphics, SubstanceTitlePane.this, false);

    Font font = SubstanceCortex.GlobalScope.getFontPolicy().getFontSet()
            .getWindowTitleFont();
    graphics.setFont(font);

    if (displayTitle != null) {
        Rectangle titleTextRect = SubstanceTitlePaneUtilities.getTitlePaneTextRectangle(this,
                (this.window != null) ? this.window : this.getRootPane());
        FontMetrics fm = SubstanceMetricsUtilities.getFontMetrics(font);
        int displayTitleWidth = fm.stringWidth(displayTitle);

        // show tooltip with full title only if necessary
        if (theTitle.equals(displayTitle)) {
            this.setToolTipText(null);
        } else {
            this.setToolTipText(theTitle);
        }

        int xOffset = 0;
        SubstanceSlices.HorizontalGravity titleTextGravity = SubstanceTitlePaneUtilities
                .getTitlePaneTextGravity();
        switch (titleTextGravity) {
            case LEADING:
                xOffset = leftToRight ? titleTextRect.x
                        : titleTextRect.x + titleTextRect.width - displayTitleWidth;
                break;
            case TRAILING:
                xOffset = leftToRight
                        ? titleTextRect.x + titleTextRect.width - displayTitleWidth
                        : titleTextRect.x;
                break;
            default:
                xOffset = titleTextRect.x + (titleTextRect.width - displayTitleWidth) / 2;
        }

        int yOffset = titleTextRect.y + (int) ((titleTextRect.getHeight() - fm.getHeight()) / 2)
                + fm.getAscent();

        SubstanceColorScheme fillScheme = skin
                .getBackgroundColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE);
        Color echoColor = !scheme.isDark() ? fillScheme.getUltraDarkColor()
                : fillScheme.getUltraLightColor();
        SubstanceTextUtilities.paintTextWithDropShadow(this, graphics,
                SubstanceColorUtilities.getForegroundColor(scheme), echoColor, displayTitle,
                width, height, xOffset, yOffset);
    }

    GhostPaintingUtils.paintGhostImages(this, graphics);

    // long end = System.nanoTime();
    // System.out.println(end - start);
    graphics.dispose();
}
 
Example 14
Source File: SubstancePaneBorder.java    From radiance with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
    SubstanceSkin skin = SubstanceCoreUtilities.getSkin(c);
    if (skin == null) {
        return;
    }

    SubstanceColorScheme scheme = skin
            .getBackgroundColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE);
    Component titlePaneComp = SubstanceCoreUtilities
            .getTitlePaneComponent(SwingUtilities.windowForComponent(c));
    SubstanceColorScheme borderScheme = skin.getColorScheme(titlePaneComp,
            ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED);

    Graphics2D graphics = (Graphics2D) g.create();

    double scaleFactor = NeonCortex.getScaleFactor();
    float strokeWidth = (scaleFactor <= 2.0f) ? 0.5f + (float) scaleFactor / 2.0f
            : (float) scaleFactor;
    graphics.setStroke(new BasicStroke(strokeWidth, BasicStroke.CAP_SQUARE,
            BasicStroke.JOIN_MITER));

    // bottom and right in ultra dark
    graphics.setColor(borderScheme.getUltraDarkColor());
    graphics.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
    graphics.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
    // top and left
    graphics.setColor(borderScheme.getDarkColor());
    graphics.drawLine(x, y, x + w - 2, y);
    graphics.drawLine(x, y, x, y + h - 2);
    // inner bottom and right
    graphics.setColor(scheme.getMidColor());
    graphics.drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2);
    graphics.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2);
    // inner top and left
    graphics.setColor(scheme.getMidColor());
    graphics.drawLine(x + 1, y + 1, x + w - 3, y + 1);
    graphics.drawLine(x + 1, y + 1, x + 1, y + h - 3);
    // inner 2 and 3
    graphics.setColor(scheme.getLightColor());
    graphics.drawRect(x + 2, y + 2, w - 5, h - 5);
    graphics.drawRect(x + 3, y + 3, w - 7, h - 7);

    graphics.dispose();
}
 
Example 15
Source File: SubstanceLabelUI.java    From radiance with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void paint(Graphics g, JComponent c) {
    JLabel label = (JLabel) c;
    String text = label.getText();

    Icon icon;
    Icon themedIcon = null;
    float rolloverAmount = 0.0f;

    if (label.isEnabled()) {
        icon = label.getIcon();
        if ((icon != null) && SubstanceCoreUtilities.useThemedDefaultIcon(label)) {
            if (label instanceof ThemedIconAwareRenderer) {
                ThemedIconAwareRenderer themedIconAwareRenderer =
                        (ThemedIconAwareRenderer) label;
                rolloverAmount = themedIconAwareRenderer.getRolloverArmAmount();
                themedIcon = SubstanceCoreUtilities.getThemedIcon(c, icon);
            } else {
                icon = SubstanceCoreUtilities.getThemedIcon(c, icon);
            }
        }
    } else {
        icon = label.getDisabledIcon();
    }

    if ((icon == null) && (text == null)) {
        return;
    }

    Insets insets = label.getInsets(paintViewInsets);
    paintViewR.x = insets.left;
    paintViewR.y = insets.top;
    paintViewR.width = c.getWidth() - (insets.left + insets.right);
    paintViewR.height = c.getHeight() - (insets.top + insets.bottom);
    paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;
    paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;

    g.setFont(label.getFont());
    String clippedText = SwingUtilities.layoutCompoundLabel(label, g.getFontMetrics(), text,
            icon, label.getVerticalAlignment(), label.getHorizontalAlignment(),
            label.getVerticalTextPosition(), label.getHorizontalTextPosition(), paintViewR,
            paintIconR, paintTextR, label.getIconTextGap());

    Graphics2D g2d = (Graphics2D) g.create();
    BackgroundPaintingUtils.updateIfOpaque(g2d, c);
    if (icon != null) {
        g2d.translate(paintIconR.x, paintIconR.y);

        if (themedIcon != null) {
            if (rolloverAmount > 0) {
                themedIcon.paintIcon(c, g2d, 0, 0);
                g2d.setComposite(WidgetUtilities.getAlphaComposite(c, rolloverAmount, g));
                icon.paintIcon(c, g2d, 0, 0);
                g2d.setComposite(WidgetUtilities.getAlphaComposite(c, g));
            } else {
                themedIcon.paintIcon(c, g2d, 0, 0);
            }
        } else {
            icon.paintIcon(c, g2d, 0, 0);
        }
        g2d.translate(-paintIconR.x, -paintIconR.y);
    }
    ComponentState labelState = label.isEnabled() ? ComponentState.ENABLED
            : ComponentState.DISABLED_UNSELECTED;
    float labelAlpha = SubstanceColorSchemeUtilities.getAlpha(label, labelState);
    if (text != null) {
        final View v = (View) c.getClientProperty(BasicHTML.propertyKey);
        if (v != null) {
            v.paint(g2d, paintTextR);
        } else {
            if (label.getClientProperty(SubstanceSynapse.IS_TITLE_PANE_LABEL) == Boolean.TRUE) {
                SubstanceSkin skin = SubstanceCoreUtilities.getSkin(label.getRootPane());
                SubstanceColorScheme scheme = skin
                        .getEnabledColorScheme(SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE);
                SubstanceColorScheme fillScheme = skin
                        .getBackgroundColorScheme(SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE);
                Color echoColor = !scheme.isDark() ? fillScheme.getUltraDarkColor()
                        : fillScheme.getUltraLightColor();
                FontMetrics fm = SubstanceMetricsUtilities.getFontMetrics(label.getFont());
                int yOffset = paintTextR.y + (int) ((paintTextR.getHeight() - fm.getHeight()) / 2)
                        + fm.getAscent();
                g2d.translate(paintTextR.x + 3, 0);
                SubstanceTextUtilities.paintTextWithDropShadow(label, g2d,
                        SubstanceColorUtilities.getForegroundColor(scheme), echoColor, clippedText,
                        paintTextR.width + 6, paintTextR.height, 0, yOffset);
            } else {
                // fix for issue 406 - use the same FG computation
                // color as for other controls
                SubstanceTextUtilities.paintText(g2d, label, paintTextR, clippedText,
                        label.getDisplayedMnemonicIndex(), labelState, labelAlpha);
            }
        }
    }
    g2d.dispose();
}