当前位置: 首页>>代码示例>>Java>>正文


Java SubstanceBorderPainter类代码示例

本文整理汇总了Java中org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter的典型用法代码示例。如果您正苦于以下问题:Java SubstanceBorderPainter类的具体用法?Java SubstanceBorderPainter怎么用?Java SubstanceBorderPainter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SubstanceBorderPainter类属于org.pushingpixels.substance.api.painter.border包,在下文中一共展示了SubstanceBorderPainter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBackgroundImage

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
private static BufferedImage createBackgroundImage(JComboBox combo,
		SubstanceButtonShaper shaper, SubstanceFillPainter fillPainter,
		SubstanceBorderPainter borderPainter, int width, int height,
		SubstanceColorScheme fillScheme, SubstanceColorScheme borderScheme,
		float radius) {
	int comboFontSize = SubstanceSizeUtils.getComponentFontSize(combo);
	int borderDelta = (int) Math.floor(SubstanceSizeUtils
			.getBorderStrokeWidth(comboFontSize) / 2.0);
	Shape contour = SubstanceOutlineUtilities.getBaseOutline(width, height,
			radius, null, borderDelta);

	BufferedImage newBackground = SubstanceCoreUtilities.getBlankImage(
			width, height);
	Graphics2D finalGraphics = (Graphics2D) newBackground.getGraphics();
	fillPainter.paintContourBackground(finalGraphics, combo, width, height,
			contour, false, fillScheme, true);
	int borderThickness = (int) SubstanceSizeUtils
			.getBorderStrokeWidth(comboFontSize);
	Shape contourInner = borderPainter.isPaintingInnerContour() ? SubstanceOutlineUtilities
			.getBaseOutline(width, height, radius - borderThickness, null,
					borderDelta + borderThickness)
			: null;
	borderPainter.paintBorder(finalGraphics, combo, width, height, contour,
			contourInner, borderScheme);
	return newBackground;
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:27,代码来源:ComboBoxBackgroundDelegate.java

示例2: createHighlighterImage

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
private static BufferedImage createHighlighterImage(Component c,
		Rectangle rect, float borderAlpha, Set<Side> openSides,
		SubstanceColorScheme currScheme,
		SubstanceColorScheme currBorderScheme,
		SubstanceHighlightPainter highlightPainter,
		SubstanceBorderPainter highlightBorderPainter) {
	BufferedImage result = SubstanceCoreUtilities.getBlankImage(rect.width,
			rect.height);
	Graphics2D resGraphics = result.createGraphics();
	highlightPainter.paintHighlight(resGraphics, c, rect.width,
			rect.height, currScheme);
	paintHighlightBorder(resGraphics, c, rect.width, rect.height,
			borderAlpha, openSides, highlightBorderPainter,
			currBorderScheme);
	resGraphics.dispose();
	return result;
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:18,代码来源:HighlightPainterUtils.java

示例3: getSingleLayer

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
private Icon getSingleLayer(JSlider slider, int width, int delta,
		SubstanceFillPainter fillPainter,
		SubstanceBorderPainter borderPainter,
		SubstanceColorScheme fillScheme,
		SubstanceColorScheme borderScheme) {
	int borderDelta = (int) Math.floor(SubstanceSizeUtils
			.getBorderStrokeWidth(SubstanceSizeUtils
					.getComponentFontSize(slider)) / 2.0);
	Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline(
			width, this.size - 1, 2, borderDelta);

	BufferedImage stateImage = SubstanceCoreUtilities.getBlankImage(
			this.size - 1, this.size - 1);
	Graphics2D g2d = stateImage.createGraphics();
	g2d.translate(delta, 0);

	fillPainter.paintContourBackground(g2d, slider, width,
			this.size - 1, contour, false, fillScheme, true);

	int borderThickness = (int) SubstanceSizeUtils
			.getBorderStrokeWidth(SubstanceSizeUtils
					.getComponentFontSize(slider));
	GeneralPath contourInner = SubstanceOutlineUtilities
			.getTriangleButtonOutline(width, this.size - 1, 2,
					borderThickness + borderDelta);

	borderPainter.paintBorder(g2d, slider, width, this.size - 1,
			contour, contourInner, borderScheme);
	g2d.translate(-delta, 0);

	if (this.isMirrorred)
		stateImage = SubstanceImageCreator.getRotated(stateImage, 2);

	return new ImageIcon(stateImage);
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:36,代码来源:SubstanceIconFactory.java

示例4: paintBorder

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
/**
 * Paints border instance of specified dimensions and status.
 * 
 * @param c
 *            Component.
 * @param graphics
 *            Graphics context.
 * @param x
 *            Component left X (in graphics context).
 * @param y
 *            Component top Y (in graphics context).
 * @param width
 *            Border width.
 * @param height
 *            Border height.
 * @param radius
 *            Border radius.
 * @param borderScheme1
 *            First border color scheme.
 * @param borderScheme2
 *            Second border color scheme.
 * @param cyclePos
 *            Cycle position for interpolating the border color schemes.
 */
public static void paintBorder(Component c, Graphics2D graphics, int x,
		int y, int width, int height, float radius,
		SubstanceColorScheme borderScheme) {

	SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
			.getBorderPainter(c);
	graphics.translate(x, y);
	int componentFontSize = SubstanceSizeUtils.getComponentFontSize(c);
	int borderDelta = (int) Math.floor(SubstanceSizeUtils
			.getBorderStrokeWidth(componentFontSize) / 2.0);
	Shape contour = SubstanceOutlineUtilities.getBaseOutline(width, height,
			radius, null, borderDelta);
	int borderThickness = (int) SubstanceSizeUtils
			.getBorderStrokeWidth(componentFontSize);
	boolean skipInnerBorder = (c instanceof JTextComponent)
			|| ((SwingUtilities.getAncestorOfClass(CellRendererPane.class,
					c) != null) && (SwingUtilities.getAncestorOfClass(
					JFileChooser.class, c) != null));
	GeneralPath contourInner = skipInnerBorder ? null
			: SubstanceOutlineUtilities.getBaseOutline(width, height,
					radius - borderThickness, null, borderThickness
							+ borderDelta);
	borderPainter.paintBorder(graphics, c, width, height, contour,
			contourInner, borderScheme);
	graphics.translate(-x, -y);
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:51,代码来源:SubstanceImageCreator.java

示例5: getThumbHorizontal

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
/**
 * Retrieves image for horizontal thumb.
 * 
 * @param scrollBar
 *            Scroll bar.
 * @param width
 *            Thumb width.
 * @param height
 *            Thumb height.
 * @param kind
 *            Color scheme kind.
 * @param cyclePos
 *            Cycle position.
 * @param scheme
 *            The first color scheme.
 * @param scheme2
 *            The second color scheme.
 * @param borderScheme
 *            The first border color scheme.
 * @param borderScheme2
 *            The second border color scheme.
 * @return Image for horizontal thumb.
 */
private static BufferedImage getThumbHorizontal(JScrollBar scrollBar,
		int width, int height, SubstanceColorScheme scheme,
		SubstanceColorScheme borderScheme) {
	SubstanceFillPainter painter = SubstanceCoreUtilities
			.getFillPainter(scrollBar);
	SubstanceButtonShaper shaper = SubstanceCoreUtilities
			.getButtonShaper(scrollBar);
	SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
			.getBorderPainter(scrollBar);
	HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
			scheme.getDisplayName(), borderScheme.getDisplayName(), painter
					.getDisplayName(), shaper.getDisplayName(),
			borderPainter.getDisplayName());

	float radius = height / 2;
	if (shaper instanceof ClassicButtonShaper)
		radius = SubstanceSizeUtils
				.getClassicButtonCornerRadius(SubstanceSizeUtils
						.getComponentFontSize(scrollBar));
	int borderDelta = (int) Math.floor(SubstanceSizeUtils
			.getBorderStrokeWidth(SubstanceSizeUtils
					.getComponentFontSize(scrollBar)) / 2.0);
	GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(width,
			height, radius, null, borderDelta);
	BufferedImage opaque = SubstanceScrollBarUI.thumbHorizontalMap.get(key);
	if (opaque == null) {
		// System.out.println("New image for horizontal thumb");

		opaque = SubstanceCoreUtilities.getBlankImage(width, height);
		painter.paintContourBackground(opaque.createGraphics(), scrollBar,
				width, height, contour, false, scheme, true);

		borderPainter.paintBorder(opaque.getGraphics(), scrollBar, width,
				height, contour, null, borderScheme);
		SubstanceScrollBarUI.thumbHorizontalMap.put(key, opaque);
	}

	return opaque;
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:63,代码来源:SubstanceScrollBarUI.java

示例6: paintHighlight

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
/**
 * Paints the highlight for the specified component.
 * 
 * @param g
 *            Graphic context.
 * @param rendererPane
 *            Renderer pane. Can be <code>null</code>.
 * @param c
 *            Component.
 * @param rect
 *            Rectangle to highlight.
 * @param borderAlpha
 *            Border alpha.
 * @param openSides
 *            The sides specified in this set will not be painted. Can be
 *            <code>null</code> or empty.
 * @param fillScheme
 *            The fill color scheme.
 * @param borderScheme
 *            The border color scheme.
 */
public static void paintHighlight(Graphics g,
		CellRendererPane rendererPane, Component c, Rectangle rect,
		float borderAlpha, Set<Side> openSides,
		SubstanceColorScheme fillScheme, SubstanceColorScheme borderScheme) {
	// fix for bug 65
	if ((rect.width <= 0) || (rect.height <= 0))
		return;

	Component compForQuerying = (rendererPane != null) ? rendererPane : c;
	SubstanceHighlightPainter highlightPainter = SubstanceCoreUtilities
			.getSkin(compForQuerying).getHighlightPainter();
	SubstanceBorderPainter highlightBorderPainter = SubstanceCoreUtilities
			.getHighlightBorderPainter(compForQuerying);
	Graphics2D g2d = (Graphics2D) g.create(rect.x, rect.y, rect.width,
			rect.height);

	if (openSides == null) {
		openSides = EnumSet.noneOf(Side.class);
	}
	if (rect.width * rect.height < 100000) {
		String openKey = "";
		for (Side oSide : openSides) {
			openKey += oSide.name() + "-";
		}

		HashMapKey key = SubstanceCoreUtilities.getHashKey(highlightPainter
				.getDisplayName(), highlightBorderPainter.getDisplayName(),
				rect.width, rect.height, fillScheme.getDisplayName(),
				borderScheme.getDisplayName(), borderAlpha, openKey);
		BufferedImage result = smallCache.get(key);
		if (result == null) {
			result = createHighlighterImage(c, rect, borderAlpha,
					openSides, fillScheme, borderScheme, highlightPainter,
					highlightBorderPainter);
			smallCache.put(key, result);
		}
		g2d.drawImage(result, 0, 0, null);
	}
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:61,代码来源:HighlightPainterUtils.java

示例7: FantasiaBorderPainter

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
public
FantasiaBorderPainter(SubstanceBorderPainter baseBorderPainter)
{ this.baseBorderPainter = baseBorderPainter; }
 
开发者ID:lxlxlo,项目名称:LS-jsampler,代码行数:4,代码来源:SubstanceFantasiaLookAndFeel.java

示例8: createBackgroundImage

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
private static BufferedImage createBackgroundImage(AbstractButton button,
		SubstanceButtonShaper shaper, SubstanceFillPainter fillPainter,
		SubstanceBorderPainter borderPainter, int width, int height,
		SubstanceColorScheme colorScheme,
		SubstanceColorScheme borderScheme, Set<Side> openSides,
		boolean isContentAreaFilled, boolean isBorderPainted) {
	int openDelta = (int) (Math.ceil(3.0 * SubstanceSizeUtils
			.getBorderStrokeWidth(SubstanceSizeUtils
					.getComponentFontSize(button))));
	int deltaLeft = ((openSides != null) && openSides.contains(Side.LEFT)) ? openDelta
			: 0;
	int deltaRight = ((openSides != null) && openSides.contains(Side.RIGHT)) ? openDelta
			: 0;
	int deltaTop = ((openSides != null) && openSides.contains(Side.TOP)) ? openDelta
			: 0;
	int deltaBottom = ((openSides != null) && openSides
			.contains(Side.BOTTOM)) ? openDelta : 0;

	// System.err.println(key);
	int borderDelta = (int) Math.floor(SubstanceSizeUtils
			.getBorderStrokeWidth(SubstanceSizeUtils
					.getComponentFontSize(button)) / 2.0);
	Shape contour = shaper.getButtonOutline(button, new Insets(borderDelta,
			borderDelta, borderDelta, borderDelta), width + deltaLeft
			+ deltaRight, height + deltaTop + deltaBottom, false);

	BufferedImage newBackground = SubstanceCoreUtilities.getBlankImage(
			width, height);
	Graphics2D finalGraphics = (Graphics2D) newBackground.getGraphics();
	finalGraphics.translate(-deltaLeft, -deltaTop);
	if (isContentAreaFilled) {
		fillPainter.paintContourBackground(finalGraphics, button, width
				+ deltaLeft + deltaRight, height + deltaTop + deltaBottom,
				contour, false, colorScheme, true);
	}

	if (isBorderPainted) {
		int borderThickness = (int) SubstanceSizeUtils
				.getBorderStrokeWidth(SubstanceSizeUtils
						.getComponentFontSize(button));
		Shape contourInner = borderPainter.isPaintingInnerContour() ? shaper
				.getButtonOutline(button, new Insets(borderDelta
						+ borderThickness, borderDelta + borderThickness,
						borderDelta + borderThickness, borderDelta
								+ borderThickness), width + deltaLeft
						+ deltaRight, height + deltaTop + deltaBottom, true)
				: null;
		borderPainter.paintBorder(finalGraphics, button, width + deltaLeft
				+ deltaRight, height + deltaTop + deltaBottom, contour,
				contourInner, borderScheme);
	}
	return newBackground;
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:54,代码来源:ButtonBackgroundDelegate.java

示例9: updateBackground

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
/**
 * Updates background of the specified button.
 * 
 * @param g
 *            Graphic context.
 * @param button
 *            Button to update.
 */
public void updateBackground(Graphics g, AbstractButton button) {
	// failsafe for LAF change
	if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
		return;

	if (SubstanceCoreUtilities.isButtonNeverPainted(button))
		return;

	int width = button.getWidth();
	int height = button.getHeight();
	int y = 0;
	if (SubstanceCoreUtilities.isScrollButton(button)
			|| SubstanceCoreUtilities.isSpinnerButton(button)) {
		Sideable sideable = (Sideable) button;
		PairwiseButtonBackgroundDelegate.updatePairwiseBackground(g,
				button, width, height, sideable.getSide(), false);
		return;
	}

	SubstanceFillPainter fillPainter = SubstanceCoreUtilities
			.getFillPainter(button);
	SubstanceButtonShaper shaper = SubstanceCoreUtilities
			.getButtonShaper(button);
	SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
			.getBorderPainter(button);

	BufferedImage bgImage = getFullAlphaBackground(button, button
			.getModel(), shaper, fillPainter, borderPainter, width, height);

	TransitionAwareUI transitionAwareUI = (TransitionAwareUI) button
			.getUI();
	StateTransitionTracker stateTransitionTracker = transitionAwareUI
			.getTransitionTracker();
	StateTransitionTracker.ModelStateInfo modelStateInfo = stateTransitionTracker
			.getModelStateInfo();
	Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
			.getStateContributionMap();

	// Two special cases here:
	// 1. Button has flat appearance.
	// 2. Button is disabled.
	// For both cases, we need to set custom translucency.
	boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(button);
	boolean isSpecial = isFlat || !button.isEnabled();
	float extraAlpha = 1.0f;
	if (isSpecial) {
		if (isFlat) {
			// Special handling of flat buttons
			extraAlpha = 0.0f;
			for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
					.entrySet()) {
				ComponentState activeState = activeEntry.getKey();
				if (activeState.isDisabled())
					continue;
				if (activeState == ComponentState.ENABLED)
					continue;
				extraAlpha += activeEntry.getValue().getContribution();
			}
		} else {
			if (!button.isEnabled()) {
				extraAlpha = SubstanceColorSchemeUtilities.getAlpha(button,
						modelStateInfo.getCurrModelState());
			}
		}
	}
	if (extraAlpha > 0.0f) {
		Graphics2D graphics = (Graphics2D) g.create();
		graphics.setComposite(LafWidgetUtilities.getAlphaComposite(button,
				extraAlpha, g));
		graphics.drawImage(bgImage, 0, y, null);
		graphics.dispose();
	}
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:82,代码来源:ButtonBackgroundDelegate.java

示例10: getIcon

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
private Icon getIcon(JSlider slider,
		StateTransitionTracker stateTransitionTracker) {
	StateTransitionTracker.ModelStateInfo modelStateInfo = stateTransitionTracker
			.getModelStateInfo();
	Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
			.getStateContributionMap();
	ComponentState currState = stateTransitionTracker
			.getModelStateInfo().getCurrModelState();

	float activeStrength = stateTransitionTracker.getActiveStrength();
	int width = (int) (this.size * (2.0 + activeStrength) / 3.0);
	width = Math.min(width, this.size - 2);
	int delta = (this.size - width) / 2;

	SubstanceFillPainter fillPainter = SubstanceCoreUtilities
			.getFillPainter(slider);
	SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
			.getBorderPainter(slider);

	SubstanceColorScheme baseFillScheme = SubstanceColorSchemeUtilities
			.getColorScheme(slider, currState);
	SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
			.getColorScheme(slider, ColorSchemeAssociationKind.BORDER,
					currState);

	HashMapKey baseKey = SubstanceCoreUtilities.getHashKey(this.size,
			width, baseFillScheme.getDisplayName(), baseBorderScheme
					.getDisplayName(), fillPainter.getDisplayName(),
			borderPainter.getDisplayName(), this.isMirrorred);

	Icon baseLayer = SliderHorizontalIcon.icons.get(baseKey);
	if (baseLayer == null) {
		baseLayer = getSingleLayer(slider, width, delta, fillPainter,
				borderPainter, baseFillScheme, baseBorderScheme);
		SliderHorizontalIcon.icons.put(baseKey, baseLayer);
	}

	if (currState.isDisabled() || (activeStates.size() == 1))
		return baseLayer;

	BufferedImage result = SubstanceCoreUtilities.getBlankImage(
			baseLayer.getIconWidth(), baseLayer.getIconHeight());
	Graphics2D g2d = result.createGraphics();
	baseLayer.paintIcon(slider, g2d, 0, 0);

	for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
			.entrySet()) {
		ComponentState activeState = activeEntry.getKey();
		if (activeState == currState)
			continue;

		float contribution = activeEntry.getValue().getContribution();
		if (contribution == 0.0f)
			continue;

		SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
				.getColorScheme(slider, activeState);
		SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
				.getColorScheme(slider,
						ColorSchemeAssociationKind.BORDER, activeState);

		HashMapKey key = SubstanceCoreUtilities.getHashKey(this.size,
				width, fillScheme.getDisplayName(), borderScheme
						.getDisplayName(),
				fillPainter.getDisplayName(), borderPainter
						.getDisplayName(), this.isMirrorred);

		Icon layer = SliderHorizontalIcon.icons.get(key);
		if (layer == null) {
			layer = getSingleLayer(slider, width, delta, fillPainter,
					borderPainter, fillScheme, borderScheme);
			SliderHorizontalIcon.icons.put(key, layer);
		}

		g2d.setComposite(AlphaComposite.SrcOver.derive(contribution));
		layer.paintIcon(slider, g2d, 0, 0);
	}

	g2d.dispose();
	return new ImageIcon(result);
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:82,代码来源:SubstanceIconFactory.java

示例11: updateBackground

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
/**
 * Updates background of the specified button.
 * 
 * @param g
 *            Graphic context.
 * @param button
 *            Button to update.
 */
public void updateBackground(Graphics g, JComboBox combo,
		ButtonModel comboModel) {
	// failsafe for LAF change
	if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
		return;

	int width = combo.getWidth();
	int height = combo.getHeight();
	int y = 0;

	SubstanceFillPainter fillPainter = SubstanceCoreUtilities
			.getFillPainter(combo);
	SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
			.getBorderPainter(combo);

	BufferedImage bgImage = getFullAlphaBackground(combo, comboModel,
			fillPainter, borderPainter, width, height);

	TransitionAwareUI transitionAwareUI = (TransitionAwareUI) combo.getUI();
	StateTransitionTracker stateTransitionTracker = transitionAwareUI
			.getTransitionTracker();
	StateTransitionTracker.ModelStateInfo modelStateInfo = stateTransitionTracker
			.getModelStateInfo();
	Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
			.getStateContributionMap();

	// Two special cases here:
	// 1. Combobox has flat appearance.
	// 2. Combobox is disabled.
	// For both cases, we need to set custom translucency.
	boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(combo, false);
	boolean isSpecial = isFlat || !combo.isEnabled();
	float extraAlpha = 1.0f;
	if (isSpecial) {
		if (isFlat) {
			// Special handling of flat combos
			extraAlpha = 0.0f;
			for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
					.entrySet()) {
				ComponentState activeState = activeEntry.getKey();
				if (activeState.isDisabled())
					continue;
				if (activeState == ComponentState.ENABLED)
					continue;
				extraAlpha += activeEntry.getValue().getContribution();
			}
		} else {
			if (!combo.isEnabled()) {
				extraAlpha = SubstanceColorSchemeUtilities.getAlpha(combo,
						modelStateInfo.getCurrModelState());
			}
		}
	}
	if (extraAlpha > 0.0f) {
		Graphics2D graphics = (Graphics2D) g.create();
		graphics.setComposite(LafWidgetUtilities.getAlphaComposite(combo,
				extraAlpha, g));
		graphics.drawImage(bgImage, 0, y, null);
		graphics.dispose();
	}
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:70,代码来源:ComboBoxBackgroundDelegate.java

示例12: paintSplitDividerBumpImage

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
/**
 * Paints the bump dots on the split pane dividers.
 * 
 * @param g
 *            Graphics context.
 * @param divider
 *            Split pane divider.
 * @param x
 *            X coordinate of the bump dots.
 * @param y
 *            Y coordinate of the bump dots.
 * @param width
 *            Width of the bump dots area.
 * @param height
 *            Height of the bump dots area.
 * @param isHorizontal
 *            Indicates whether the dots are horizontal.
 * @param componentState
 *            Split pane divider state.
 * @param colorScheme1
 *            First color scheme.
 * @param colorScheme2
 *            Second color scheme.
 * @param interpolationCyclePos
 *            Interpolation cycle.
 */
public static void paintSplitDividerBumpImage(Graphics g,
		SubstanceSplitPaneDivider divider, int x, int y, int width,
		int height, boolean isHorizontal, SubstanceColorScheme colorScheme) {
	Graphics2D graphics = (Graphics2D) g.create();
	graphics.translate(x, y);

	graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
			RenderingHints.VALUE_ANTIALIAS_ON);

	int componentFontSize = SubstanceSizeUtils
			.getComponentFontSize(divider);
	int bumpDotDiameter = SubstanceSizeUtils
			.getBigDragBumpDiameter(componentFontSize);
	int bumpCellSize = (int) (1.5 * bumpDotDiameter + 1);
	int bumpRows = isHorizontal ? 1 : Math
			.max(1, height / bumpCellSize - 1);
	int bumpColumns = isHorizontal ? Math
			.max(1, (width - 2) / bumpCellSize) : 1;

	int bumpRowOffset = (height - bumpCellSize * bumpRows) / 2;
	int bumpColOffset = 1 + (width - bumpCellSize * bumpColumns) / 2;

	BufferedImage singleDot = SubstanceCoreUtilities.getBlankImage(
			bumpDotDiameter, bumpDotDiameter);
	Graphics2D dotGraphics = (Graphics2D) singleDot.getGraphics();
	dotGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
			RenderingHints.VALUE_ANTIALIAS_ON);

	Color markColor = SubstanceColorUtilities.getMarkColor(colorScheme,
			divider.isEnabled());
	dotGraphics.setColor(markColor);
	dotGraphics.fillOval(0, 0, bumpDotDiameter, bumpDotDiameter);

	dotGraphics.setComposite(AlphaComposite.getInstance(
			AlphaComposite.SRC_OVER, 0.4f));
	SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
			.getBorderPainter(divider);
	borderPainter.paintBorder(dotGraphics, divider, width, height,
			new Ellipse2D.Float(0, 0, bumpDotDiameter - 1,
					bumpDotDiameter - 1), null, colorScheme);

	graphics.setComposite(LafWidgetUtilities.getAlphaComposite(divider,
			0.8f, g));
	for (int col = 0; col < bumpColumns; col++) {
		int cx = bumpColOffset + col * bumpCellSize;
		for (int row = 0; row < bumpRows; row++) {
			int cy = bumpRowOffset + row * bumpCellSize
					+ (bumpCellSize - bumpDotDiameter) / 2;
			graphics.drawImage(singleDot, cx, cy, null);
		}
	}
	graphics.dispose();
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:80,代码来源:SubstanceImageCreator.java

示例13: getCloseButtonImage

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
/**
 * Retrieves the image of the close button.
 * 
 * @param tabPane
 *            Tabbed pane.
 * @param width
 *            Close button width.
 * @param height
 *            Close button height.
 * @param cyclePos
 *            Tab cycle position (for rollover effects).
 * @param toPaintBorder
 *            Indication whether the button background (including contour)
 *            needs to be painted.
 * @param fillScheme
 *            Color scheme for coloring the background.
 * @param fillScheme2
 *            Second color scheme for coloring the background.
 * @param markScheme
 *            Color scheme for painting the close mark.
 * @param markScheme2
 *            Second color scheme for painting the close mark.
 * @return Image of the close button of specified parameters.
 */
private static BufferedImage getCloseButtonImage(JTabbedPane tabPane,
		int width, int height, boolean toPaintBorder,
		SubstanceColorScheme fillScheme, SubstanceColorScheme markScheme) {
	SubstanceFillPainter fillPainter = SubstanceCoreUtilities
			.getFillPainter(tabPane);
	if (fillPainter == null)
		return null;

	HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
			toPaintBorder, fillPainter.getDisplayName(), fillScheme
					.getDisplayName(), markScheme.getDisplayName());
	BufferedImage result = SubstanceTabbedPaneUI.closeButtonMap.get(key);
	if (result == null) {
		result = SubstanceCoreUtilities.getBlankImage(width, height);
		Graphics2D finalGraphics = (Graphics2D) result.getGraphics();

		if (toPaintBorder) {
			GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(
					width, height, 1, null);
			fillPainter.paintContourBackground(finalGraphics, tabPane,
					width, height, contour, false, fillScheme, true);
			// finalGraphics.drawImage(background, 0, 0, null);
			SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
					.getBorderPainter(tabPane);
			finalGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
					RenderingHints.VALUE_ANTIALIAS_ON);
			borderPainter.paintBorder(finalGraphics, tabPane, width,
					height, contour, null, markScheme);
		}

		finalGraphics.setStroke(new BasicStroke(SubstanceSizeUtils
				.getTabCloseButtonStrokeWidth(SubstanceSizeUtils
						.getComponentFontSize(tabPane))));

		int delta = (int) (Math.floor(SubstanceSizeUtils
				.getBorderStrokeWidth(SubstanceSizeUtils
						.getComponentFontSize(tabPane))));
		if (delta % 2 != 0)
			delta--;
		int iconSize = width - delta;

		Icon closeIcon = SubstanceImageCreator.getCloseIcon(iconSize,
				markScheme, markScheme);
		closeIcon.paintIcon(tabPane, finalGraphics, delta / 2, delta / 2);

		SubstanceTabbedPaneUI.closeButtonMap.put(key, result);
	}
	return result;
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:74,代码来源:SubstanceTabbedPaneUI.java

示例14: paintSliderTrack

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
/**
 * Paints the slider track.
 * 
 * @param graphics
 *            Graphics.
 * @param drawInverted
 *            Indicates whether the value-range shown for the slider is
 *            reversed.
 * @param fillColorScheme
 *            Fill color scheme.
 * @param borderScheme
 *            Border color scheme.
 * @param width
 *            Track width.
 * @param height
 *            Track height.
 */
private void paintSliderTrack(Graphics2D graphics, boolean drawInverted,
		SubstanceColorScheme fillColorScheme,
		SubstanceColorScheme borderScheme, int width, int height) {
	Graphics2D g2d = (Graphics2D) graphics.create();

	SubstanceFillPainter fillPainter = ClassicFillPainter.INSTANCE;
	SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
			.getBorderPainter(this.slider);

	int componentFontSize = SubstanceSizeUtils
			.getComponentFontSize(this.slider);
	int borderDelta = (int) Math.floor(SubstanceSizeUtils
			.getBorderStrokeWidth(componentFontSize) / 2.0);
	float radius = SubstanceSizeUtils
			.getClassicButtonCornerRadius(componentFontSize) / 2.0f;
	int borderThickness = (int) SubstanceSizeUtils
			.getBorderStrokeWidth(componentFontSize);

	HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
			radius, borderDelta, borderThickness, fillColorScheme
					.getDisplayName(), borderScheme.getDisplayName());

	BufferedImage trackImage = trackCache.get(key);
	if (trackImage == null) {
		trackImage = SubstanceCoreUtilities.getBlankImage(width + 1,
				height + 1);
		Graphics2D cacheGraphics = trackImage.createGraphics();

		Shape contour = SubstanceOutlineUtilities.getBaseOutline(width + 1,
				height + 1, radius, null, borderDelta);

		fillPainter.paintContourBackground(cacheGraphics, slider, width,
				height, contour, false, fillColorScheme, false);

		GeneralPath contourInner = SubstanceOutlineUtilities
				.getBaseOutline(width + 1, height + 1, radius
						- borderThickness, null, borderThickness
						+ borderDelta);
		borderPainter.paintBorder(cacheGraphics, slider, width + 1,
				height + 1, contour, contourInner, borderScheme);

		trackCache.put(key, trackImage);
		cacheGraphics.dispose();
	}

	g2d.drawImage(trackImage, 0, 0, null);

	g2d.dispose();
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:67,代码来源:SubstanceSliderUI.java

示例15: getTrackHorizontal

import org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter; //导入依赖的package包/类
/**
 * Returns the image for a horizontal track.
 * 
 * @param scrollBar
 *            Scroll bar.
 * @param trackBounds
 *            Track bounds.
 * @param compLeftState
 *            The state of the left button in the scroll bar.
 * @param compRightState
 *            The state of the closest right button in the scroll bar.
 * @param width
 *            Scroll track width.
 * @param height
 *            Scroll track height.
 * @param graphicsComposite
 *            Composite to apply before painting the track.
 * @return Horizontal track image.
 */
private static BufferedImage getTrackHorizontal(JScrollBar scrollBar,
		int width, int height) {
	SubstanceButtonShaper shaper = SubstanceCoreUtilities
			.getButtonShaper(scrollBar);
	SubstanceColorScheme mainScheme = SubstanceColorSchemeUtilities
			.getColorScheme(scrollBar,
					scrollBar.isEnabled() ? ComponentState.ENABLED
							: ComponentState.DISABLED_UNSELECTED);
	SubstanceColorScheme mainBorderScheme = SubstanceColorSchemeUtilities
			.getColorScheme(scrollBar, ColorSchemeAssociationKind.BORDER,
					scrollBar.isEnabled() ? ComponentState.ENABLED
							: ComponentState.DISABLED_UNSELECTED);
	HashMapKey key = SubstanceCoreUtilities.getHashKey(mainScheme
			.getDisplayName(), mainBorderScheme.getDisplayName(), width,
			height, shaper.getDisplayName());
	float radius = height / 2;
	if (shaper instanceof ClassicButtonShaper)
		radius = SubstanceSizeUtils
				.getClassicButtonCornerRadius(SubstanceSizeUtils
						.getComponentFontSize(scrollBar));

	int borderDelta = (int) Math.floor(SubstanceSizeUtils
			.getBorderStrokeWidth(SubstanceSizeUtils
					.getComponentFontSize(scrollBar)) / 2.0);
	Shape contour = SubstanceOutlineUtilities.getBaseOutline(width, height,
			radius, null, borderDelta);
	BufferedImage result = SubstanceScrollBarUI.trackHorizontalMap.get(key);
	if (result == null) {
		result = SubstanceCoreUtilities.getBlankImage(width, height);
		SimplisticFillPainter.INSTANCE.paintContourBackground(result
				.createGraphics(), scrollBar, width, height, contour,
				false, mainScheme, true);

		SubstanceBorderPainter borderPainter = new SimplisticSoftBorderPainter();
		borderPainter.paintBorder(result.getGraphics(), scrollBar, width,
				height, contour, null, mainBorderScheme);

		SubstanceScrollBarUI.trackHorizontalMap.put(key, result);
	}
	return result;
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:61,代码来源:SubstanceScrollBarUI.java


注:本文中的org.pushingpixels.substance.api.painter.border.SubstanceBorderPainter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。