org.pushingpixels.substance.api.SubstanceSkin Java Examples
The following examples show how to use
org.pushingpixels.substance.api.SubstanceSkin.
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: GraphiteGlassSkin.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates a new <code>Graphite</code> skin. */ public GraphiteGlassSkin() { super(); SubstanceSkin.ColorSchemes schemes = SubstanceSkin.getColorSchemes( this.getClass().getClassLoader().getResourceAsStream( "org/pushingpixels/substance/api/skin/graphite.colorschemes")); SubstanceColorScheme backgroundScheme = schemes.get("Graphite Background"); this.registerAsDecorationArea(backgroundScheme, DecorationAreaType.PRIMARY_TITLE_PANE, DecorationAreaType.SECONDARY_TITLE_PANE, DecorationAreaType.HEADER); // add two overlay painters to create a bezel line between // menu bar and toolbars BottomLineOverlayPainter menuOverlayPainter = new BottomLineOverlayPainter( ColorSchemeSingleColorQuery.MID); TopLineOverlayPainter toolbarOverlayPainter = new TopLineOverlayPainter( (SubstanceColorScheme scheme) -> SubstanceColorUtilities.getAlphaColor( scheme.getForegroundColor(), 32)); this.addOverlayPainter(menuOverlayPainter, DecorationAreaType.HEADER); this.addOverlayPainter(toolbarOverlayPainter, DecorationAreaType.TOOLBAR); this.fillPainter = new GlassFillPainter(); this.decorationPainter = new ArcDecorationPainter(); this.highlightPainter = new GlassHighlightPainter(); }
Example #2
Source File: SubstanceLatchWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean updateWatermarkImage(SubstanceSkin skin) { // fix by Chris for bug 67 - support for multiple screens Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); for (GraphicsDevice gd : gds) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); virtualBounds = virtualBounds.union(gc.getBounds()); } int screenWidth = virtualBounds.width; int screenHeight = virtualBounds.height; SubstanceLatchWatermark.watermarkImage = NeonCortex .getBlankImage(screenWidth, screenHeight); Graphics2D graphics = SubstanceLatchWatermark.watermarkImage.createGraphics(); boolean status = this.drawWatermarkImage(skin, graphics, 0, 0, screenWidth, screenHeight, false); graphics.dispose(); return status; }
Example #3
Source File: SubstanceExceedWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean updateWatermarkImage(SubstanceSkin skin) { // fix by Chris for bug 67 - support for multiple screens Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); for (GraphicsDevice gd : gds) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); virtualBounds = virtualBounds.union(gc.getBounds()); } int screenWidth = virtualBounds.width; int screenHeight = virtualBounds.height; SubstanceExceedWatermark.watermarkImage = NeonCortex.getBlankImage(screenWidth, screenHeight); Graphics2D graphics = SubstanceExceedWatermark.watermarkImage.createGraphics(); boolean status = this.drawWatermarkImage(skin, graphics, 0, 0, screenWidth, screenHeight, false); graphics.dispose(); return status; }
Example #4
Source File: SubstanceFlameFractalWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Draws the specified portion of the watermark image. * * @param graphics Graphic context. * @param x the <i>x</i> coordinate of the watermark to be drawn. * @param y The <i>y</i> coordinate of the watermark to be drawn. * @param width The width of the watermark to be drawn. * @param height The height of the watermark to be drawn. * @param isPreview Indication whether the result is a preview image. * @return Indication whether the draw succeeded. */ private boolean drawWatermarkImage(SubstanceSkin skin, Graphics2D graphics, int x, int y, int width, int height, boolean isPreview) { if (isPreview) { // graphics.drawImage(NoiseFactory.getNoiseImage( // SubstanceCoreUtilities.getDefaultTheme(null) // .getFirstTheme().getColorScheme(), // SubstanceCoreUtilities.getDefaultTheme(null) // .getSecondTheme().getColorScheme(), width, height, // this.xFactor, this.yFactor, this.hasConstantZ, // this.noiseFilter, this.toBlur), x, y, null); } else { SubstanceColorScheme scheme = skin.getWatermarkColorScheme(); int alpha = scheme.isDark() ? 200 : 250; graphics.setComposite(AlphaComposite.getInstance( AlphaComposite.SRC_OVER, alpha / 255.0f)); NeonCortex.drawImage(graphics, FractalFlameFactory.getFractalFlameImage(scheme, scheme, width, height, 25000000, this.functionSystem), x, y); } return true; }
Example #5
Source File: SubstanceColorSchemeUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns the color scheme of the specified tabbed pane tab. * * @param jtp Tabbed pane. * @param tabIndex Tab index. * @param componentState Tab component state. * @return The color scheme of the specified tabbed pane tab. */ public static SubstanceColorScheme getColorScheme(final JTabbedPane jtp, final int tabIndex, ColorSchemeAssociationKind associationKind, ComponentState componentState) { SubstanceSkin skin = SubstanceCoreUtilities.getSkin(jtp); if (skin == null) { SubstanceCoreUtilities.traceSubstanceApiUsage(jtp, "Substance delegate used when Substance is not the current LAF"); } SubstanceColorScheme nonColorized = skin.getColorScheme(jtp, associationKind, componentState); if (tabIndex >= 0) { Component component = jtp.getComponentAt(tabIndex); SubstanceColorScheme colorized = getColorizedScheme(component, nonColorized, jtp.getForegroundAt(tabIndex), jtp.getBackgroundAt(tabIndex), !componentState.isDisabled()); return colorized; } else { return getColorizedScheme(jtp, nonColorized, !componentState.isDisabled()); } }
Example #6
Source File: SubstanceBinaryWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean updateWatermarkImage(SubstanceSkin skin) { // fix by Chris for bug 67 - support for multiple screens Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); for (GraphicsDevice gd : gds) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); virtualBounds = virtualBounds.union(gc.getBounds()); } int screenWidth = virtualBounds.width; int screenHeight = virtualBounds.height; SubstanceBinaryWatermark.watermarkImage = NeonCortex.getBlankImage(screenWidth, screenHeight); Graphics2D graphics = SubstanceBinaryWatermark.watermarkImage.createGraphics(); boolean status = this.drawWatermarkImage(skin, graphics, 0, 0, screenWidth, screenHeight, false); graphics.dispose(); return status; }
Example #7
Source File: SubstanceCrosshatchWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean updateWatermarkImage(SubstanceSkin skin) { // fix by Chris for bug 67 - support for multiple screens Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); for (GraphicsDevice gd : gds) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); virtualBounds = virtualBounds.union(gc.getBounds()); } int screenWidth = virtualBounds.width; int screenHeight = virtualBounds.height; SubstanceCrosshatchWatermark.watermarkImage = NeonCortex.getBlankImage(screenWidth, screenHeight); Graphics2D graphics = SubstanceCrosshatchWatermark.watermarkImage.createGraphics(); boolean status = this.drawWatermarkImage(skin, graphics, 0, 0, screenWidth, screenHeight, false); graphics.dispose(); return status; }
Example #8
Source File: SetRootPaneSkin.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Opens a sample frame under the specified skin. * * @param skin * Skin. */ private void openSampleFrame(SubstanceSkin skin) { JFrame sampleFrame = new JFrame(skin.getDisplayName()); sampleFrame.setLayout(new FlowLayout()); JButton defaultButton = new JButton("active"); JButton button = new JButton("default"); JButton disabledButton = new JButton("disabled"); disabledButton.setEnabled(false); sampleFrame.getRootPane().setDefaultButton(defaultButton); sampleFrame.add(defaultButton); sampleFrame.add(button); sampleFrame.add(disabledButton); sampleFrame.setVisible(true); sampleFrame.pack(); sampleFrame.setLocationRelativeTo(null); sampleFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); sampleFrame.setIconImage(new BufferedImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR)); SubstanceCortex.RootPaneScope.setSkin(sampleFrame.getRootPane(), skin); SwingUtilities.updateComponentTreeUI(sampleFrame); sampleFrame.repaint(); }
Example #9
Source File: SubstanceKatakanaWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean updateWatermarkImage(SubstanceSkin skin) { if (font == null) { return false; } // fix by Chris for bug 67 - support for multiple screens Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); for (GraphicsDevice gd : gds) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); virtualBounds = virtualBounds.union(gc.getBounds()); } int screenWidth = virtualBounds.width; int screenHeight = virtualBounds.height; SubstanceKatakanaWatermark.watermarkImage = NeonCortex.getBlankImage(screenWidth, screenHeight); Graphics2D graphics = SubstanceKatakanaWatermark.watermarkImage.createGraphics(); boolean status = this.drawWatermarkImage(skin, graphics, 0, 0, screenWidth, screenHeight, false); graphics.dispose(); return status; }
Example #10
Source File: SubstanceRootPaneUI.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Invokes super implementation to uninstall any of its state. This will also reset the * <code>LayoutManager</code> of the <code>JRootPane</code>. If a <code>Component</code> has * been added to the <code>JRootPane</code> to render the window decoration style, this method * will remove it. Similarly, this will revert the Border and LayoutManager of the * <code>JRootPane</code> to what it was before <code>installUI</code> was invoked. * * @param c * the JRootPane to uninstall state from */ @Override public void uninstallUI(JComponent c) { super.uninstallUI(c); this.uninstallClientDecorations(this.root); this.layoutManager = null; this.substanceMouseInputListener = null; if (this.root.getClientProperty(SubstanceSynapse.ROOT_PANE_SKIN) instanceof SubstanceSkin) { rootPanesWithCustomSkin--; } this.root = null; for (SubstanceWidget lafWidget : this.lafWidgets) { lafWidget.uninstallUI(); } }
Example #11
Source File: SubstanceMosaicWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean updateWatermarkImage(SubstanceSkin skin) { // fix by Chris for bug 67 - support for multiple screens Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); for (GraphicsDevice gd : gds) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); virtualBounds = virtualBounds.union(gc.getBounds()); } int screenWidth = virtualBounds.width; int screenHeight = virtualBounds.height; SubstanceMosaicWatermark.watermarkImage = NeonCortex.getBlankImage(screenWidth, screenHeight); Graphics2D graphics = SubstanceMosaicWatermark.watermarkImage.createGraphics(); boolean status = this.drawWatermarkImage(skin, graphics, 0, 0, screenWidth, screenHeight, false); graphics.dispose(); return status; }
Example #12
Source File: ClassicDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@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 #13
Source File: ImageWrapperDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 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 #14
Source File: SubstanceStripeWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean updateWatermarkImage(SubstanceSkin skin) { // fix by Chris for bug 67 - support for multiple screens Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); for (GraphicsDevice gd : gds) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); virtualBounds = virtualBounds.union(gc.getBounds()); } int screenWidth = virtualBounds.width; int screenHeight = virtualBounds.height; SubstanceStripeWatermark.watermarkImage = SubstanceCoreUtilities .getBlankImage(screenWidth, screenHeight); Graphics2D graphics = SubstanceStripeWatermark.watermarkImage.createGraphics(); boolean status = this.drawWatermarkImage(skin, graphics, 0, 0, screenWidth, screenHeight, false); graphics.dispose(); return status; }
Example #15
Source File: SubstanceBrushedMetalWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean updateWatermarkImage(SubstanceSkin skin) { // fix by Chris for bug 67 - support for multiple screens Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); for (GraphicsDevice gd : gds) { GraphicsConfiguration gc = gd.getDefaultConfiguration(); virtualBounds = virtualBounds.union(gc.getBounds()); } int screenWidth = virtualBounds.width; int screenHeight = virtualBounds.height; SubstanceBrushedMetalWatermark.watermarkImage = NeonCortex .getBlankImage(screenWidth, screenHeight); Graphics2D graphics = SubstanceBrushedMetalWatermark.watermarkImage.createGraphics(); Composite comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f); graphics.setComposite(comp); boolean status = this.drawWatermarkImage(graphics, 0, 0, screenWidth, screenHeight, false); graphics.dispose(); return status; }
Example #16
Source File: OverlayPainterUtils.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Paints all registered overlays on the specified component. Overlay * painters are registered with * {@link SubstanceSkin#addOverlayPainter(SubstanceOverlayPainter, DecorationAreaType...)} * API. * * @param g * Graphics context. * @param c * Component. * @param skin * Component skin. * @param decorationAreaType * Component decoration area type. */ public static void paintOverlays(Graphics g, Component c, SubstanceSkin skin, DecorationAreaType decorationAreaType) { List<SubstanceOverlayPainter> overlayPainters = skin .getOverlayPainters(decorationAreaType); if (overlayPainters.size() == 0) { return; } for (SubstanceOverlayPainter overlayPainter : overlayPainters) { Graphics2D g2d = (Graphics2D) g.create(); overlayPainter.paintOverlay(g2d, c, decorationAreaType, c .getWidth(), c.getHeight(), skin); g2d.dispose(); } }
Example #17
Source File: TopShadowOverlayPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintOverlay(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { Color shadowColor = SubstanceColorUtilities.deriveByBrightness( SubstanceColorUtilities.getBackgroundFillColor(comp), -0.4f); // need to handle components "embedded" in other components Component topMostWithSameDecorationAreaType = SubstanceCoreUtilities .getTopMostParentWithDecorationAreaType(comp, decorationAreaType); Point inTopMost = SwingUtilities.convertPoint(comp, new Point(0, 0), topMostWithSameDecorationAreaType); int dy = inTopMost.y; Graphics2D g2d = (Graphics2D) graphics.create(); g2d.translate(0, -dy); g2d.setPaint(new GradientPaint( 0, 0, SubstanceColorUtilities.getAlphaColor(shadowColor, this.startAlpha), 0, 4, SubstanceColorUtilities.getAlphaColor(shadowColor, 16))); g2d.fillRect(0, 0, comp.getWidth(), 4); g2d.dispose(); }
Example #18
Source File: GraphiteAquaSkin.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates a new <code>Graphite Aqua</code> skin. */ public GraphiteAquaSkin() { super(new AccentBuilder() .withAccentResource("org/pushingpixels/substance/api/skin/graphite.colorschemes") .withActiveControlsAccent("Graphite Aqua") .withHighlightsAccent("Graphite Aqua")); // Use disabled color scheme for marks of disabled selected checkboxes and radio buttons // for better contrast ColorSchemes schemes = SubstanceSkin.getColorSchemes( this.getClass().getClassLoader().getResourceAsStream( "org/pushingpixels/substance/api/skin/graphite.colorschemes")); SubstanceColorScheme disabledScheme = schemes.get("Graphite Disabled"); defaultSchemeBundle.registerColorScheme(disabledScheme, ColorSchemeAssociationKind.MARK, ComponentState.DISABLED_SELECTED); }
Example #19
Source File: ImageWrapperDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 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 #20
Source File: SubstanceRibbonBandUI.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
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 #21
Source File: FractionBasedDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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 #22
Source File: ArcDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void paintDecorationArea(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { if ((decorationAreaType == DecorationAreaType.PRIMARY_TITLE_PANE) || (decorationAreaType == DecorationAreaType.SECONDARY_TITLE_PANE)) { this.paintTitleBackground(graphics, comp, width, height, skin.getBackgroundColorScheme(decorationAreaType)); } else { this.paintExtraBackground(graphics, SubstanceCoreUtilities.getHeaderParent(comp), comp, width, height, skin.getBackgroundColorScheme(decorationAreaType)); } }
Example #23
Source File: SampleInternalFrame.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Synchronizes the frame icon with the current theme. */ protected void synchronize() { SwingUtilities.invokeLater(() -> { if (UIManager.getLookAndFeel() instanceof SubstanceLookAndFeel) { SubstanceSkin currentSkin = SubstanceCortex.ComponentScope .getCurrentSkin(getRootPane()); setFrameIcon(RadianceLogo.getLogoIcon( currentSkin.getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED))); setTitle(currentSkin.getDisplayName()); } }); }
Example #24
Source File: BottomLineOverlayPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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 #25
Source File: TopBezelOverlayPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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 #26
Source File: SubstanceCrosshatchWatermark.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Draws the specified portion of the watermark image. * * @param skin Skin to use for painting the watermark. * @param graphics Graphic context. * @param x the <i>x</i> coordinate of the watermark to be drawn. * @param y The <i>y</i> coordinate of the watermark to be drawn. * @param width The width of the watermark to be drawn. * @param height The height of the watermark to be drawn. * @param isPreview Indication whether the result is a preview image. * @return Indication whether the draw succeeded. */ private boolean drawWatermarkImage(SubstanceSkin skin, Graphics2D graphics, int x, int y, int width, int height, boolean isPreview) { Color stampColorDark = null; Color stampColorAll = null; Color stampColorLight = null; SubstanceColorScheme scheme = skin.getWatermarkColorScheme(); if (isPreview) { stampColorDark = scheme.isDark() ? Color.white : Color.black; stampColorAll = Color.lightGray; stampColorLight = scheme.isDark() ? Color.black : Color.white; } else { stampColorDark = scheme.getWatermarkDarkColor(); stampColorAll = scheme.getWatermarkStampColor(); stampColorLight = scheme.getWatermarkLightColor(); } graphics.setColor(stampColorAll); graphics.fillRect(0, 0, width, height); BufferedImage tile = NeonCortex.getBlankUnscaledImage(4, 4); tile.setRGB(0, 0, stampColorDark.getRGB()); tile.setRGB(2, 2, stampColorDark.getRGB()); tile.setRGB(0, 1, stampColorLight.getRGB()); tile.setRGB(2, 3, stampColorLight.getRGB()); Graphics2D g2d = (Graphics2D) graphics.create(); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f)); for (int row = y; row < (y + height); row += 4) { for (int col = x; col < (x + width); col += 4) { g2d.drawImage(tile, col, row, null); } } g2d.dispose(); return true; }
Example #27
Source File: SubstanceRootPaneUI.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void propertyChange(PropertyChangeEvent e) { super.propertyChange(e); String propertyName = e.getPropertyName(); if (propertyName == null) { return; } if (propertyName.equals("windowDecorationStyle")) { JRootPane root = (JRootPane) e.getSource(); int style = root.getWindowDecorationStyle(); this.uninstallClientDecorations(root); if (style != JRootPane.NONE) { this.installClientDecorations(root); } } if (propertyName.equals("ancestor")) { this.uninstallWindowListeners(this.root); if (((JRootPane) e.getSource()).getWindowDecorationStyle() != JRootPane.NONE) { this.installWindowListeners(this.root, this.root.getParent()); } } if (propertyName.equals("background")) { SubstanceCoreUtilities.getTitlePaneComponent(window) .setBackground((Color) e.getNewValue()); } if (propertyName.equals(SubstanceSynapse.ROOT_PANE_SKIN)) { SubstanceSkin oldValue = (SubstanceSkin) e.getOldValue(); SubstanceSkin newValue = (SubstanceSkin) e.getNewValue(); if ((oldValue == null) && (newValue != null)) { rootPanesWithCustomSkin++; } if ((oldValue != null) && (newValue == null)) { rootPanesWithCustomSkin--; } } }
Example #28
Source File: BusinessBlueSteelSkin.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Creates a new <code>Business Blue Steel</code> skin. */ public BusinessBlueSteelSkin() { super(new AccentBuilder() .withAccentResource("org/pushingpixels/substance/api/skin/business.colorschemes") .withWindowChromeAccent("Business Blue Steel Active Header") .withActiveControlsAccent("Business Blue Steel Active") .withHighlightsAccent("Business Blue Steel Highlight")); SubstanceSkin.ColorSchemes businessSchemes = SubstanceSkin.getColorSchemes( this.getClass().getClassLoader().getResourceAsStream( "org/pushingpixels/substance/api/skin/business.colorschemes")); SubstanceColorScheme disabledScheme = businessSchemes.get("Business Blue Steel Disabled"); SubstanceColorScheme activeHeaderScheme = businessSchemes .get("Business Blue Steel Active Header"); SubstanceColorScheme enabledHeaderScheme = businessSchemes .get("Business Blue Steel Enabled Header"); SubstanceColorSchemeBundle headerSchemeBundle = new SubstanceColorSchemeBundle( activeHeaderScheme, enabledHeaderScheme, enabledHeaderScheme); headerSchemeBundle.registerAlpha(0.5f, ComponentState.DISABLED_UNSELECTED, ComponentState.DISABLED_SELECTED); headerSchemeBundle.registerColorScheme(enabledHeaderScheme, ComponentState.DISABLED_UNSELECTED, ComponentState.DISABLED_SELECTED); this.registerDecorationAreaSchemeBundle(headerSchemeBundle, DecorationAreaType.PRIMARY_TITLE_PANE, DecorationAreaType.SECONDARY_TITLE_PANE, DecorationAreaType.HEADER); SubstanceColorScheme activeGeneralScheme = businessSchemes .get("Business Blue Steel Active General"); SubstanceColorScheme enabledGeneralScheme = businessSchemes .get("Business Blue Steel Enabled General"); SubstanceColorSchemeBundle generalSchemeBundle = new SubstanceColorSchemeBundle( activeGeneralScheme, enabledGeneralScheme, disabledScheme); generalSchemeBundle.registerAlpha(0.7f, ComponentState.DISABLED_UNSELECTED); generalSchemeBundle.registerColorScheme(enabledGeneralScheme, ComponentState.DISABLED_UNSELECTED); this.registerDecorationAreaSchemeBundle(generalSchemeBundle, DecorationAreaType.FOOTER, DecorationAreaType.GENERAL); }
Example #29
Source File: FlatDecorationPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void paintDecorationArea(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { graphics.setColor(SubstanceCoreUtilities.getBackgroundFill( skin, DecorationAreaType.PRIMARY_TITLE_PANE)); // skin.getBackgroundColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE) // .getBackgroundFillColor()); graphics.fillRect(0, 0, width, height); }
Example #30
Source File: BottomShadowOverlayPainter.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void paintOverlay(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { Color shadowColor = SubstanceColorUtilities.deriveByBrightness( SubstanceColorUtilities.getBackgroundFillColor(comp), -0.4f); Component topMostWithSameDecorationAreaType = SubstanceCoreUtilities .getTopMostParentWithDecorationAreaType(comp, decorationAreaType); int topHeight = topMostWithSameDecorationAreaType.getHeight(); Point inTopMost = SwingUtilities.convertPoint(comp, new Point(0, 0), topMostWithSameDecorationAreaType); int dy = inTopMost.y; Graphics2D fillGraphics = (Graphics2D) graphics.create(); fillGraphics.translate(0, -dy); int shadowHeight = 4; GradientPaint fillPaint = new GradientPaint(0, topHeight - shadowHeight, SubstanceColorUtilities.getAlphaColor(shadowColor, 0), 0, topHeight, SubstanceColorUtilities.getAlphaColor(shadowColor, this.endAlpha)); fillGraphics.setPaint(fillPaint); fillGraphics.fillRect(0, topHeight - shadowHeight, width, shadowHeight); fillGraphics.dispose(); }