org.pushingpixels.substance.api.ComponentState Java Examples
The following examples show how to use
org.pushingpixels.substance.api.ComponentState.
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: BreadCrumbTest.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Main method for testing. * * @param args Ignored. */ public static void main(String... args) { SwingUtilities.invokeLater(() -> { JFrame.setDefaultLookAndFeelDecorated(true); SubstanceCortex.GlobalScope.setSkin(new BusinessSkin()); BreadCrumbTest test = new BreadCrumbTest(); test.setIconImage(RadianceLogo.getLogoImage( SubstanceCortex.GlobalScope.getCurrentSkin().getColorScheme( SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE, SubstanceSlices.ColorSchemeAssociationKind.FILL, ComponentState.ENABLED))); test.setSize(550, 385); test.setLocationRelativeTo(null); test.setVisible(true); test.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }); }
Example #2
Source File: ArrowButtonTransitionAwareIcon.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates an arrow icon. * * @param component * Arrow button. * @param orientation * Arrow icon orientation. */ public ArrowButtonTransitionAwareIcon( final JComponent component, TransitionAwareIcon.TransitionAwareUIDelegate transitionAwareUIDelegate, final int orientation) { this.component = component; this.transitionAwareUIDelegate = transitionAwareUIDelegate; this.orientation = orientation; this.delegate = (SubstanceColorScheme scheme) -> { int fontSize = SubstanceSizeUtils.getComponentFontSize(component); return SubstanceImageCreator.getArrowIcon(fontSize, orientation, scheme); }; Icon enabledIcon = this.delegate.getColorSchemeIcon( SubstanceColorSchemeUtilities.getColorScheme(component, ComponentState.ENABLED)); this.iconWidth = enabledIcon.getIconWidth(); this.iconHeight = enabledIcon.getIconHeight(); }
Example #3
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 #4
Source File: SubstanceTreeUI.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns the current state for the specified path. * * @param pathId * Path index. * @return The current state for the specified path. */ public ComponentState getPathState(TreePathId pathId) { boolean isEnabled = this.tree.isEnabled(); StateTransitionTracker tracker = this.stateTransitionMultiTracker.getTracker(pathId); if (tracker == null) { int rowIndex = this.tree.getRowForPath(pathId.path); boolean isRollover = (this.currRolloverPathId != null) && pathId.equals(this.currRolloverPathId); boolean isSelected = this.tree.isRowSelected(rowIndex); return ComponentState.getState(isEnabled, isRollover, isSelected); } else { ComponentState fromTracker = tracker.getModelStateInfo().getCurrModelState(); return ComponentState.getState(isEnabled, fromTracker.isFacetActive(ComponentStateFacet.ROLLOVER), fromTracker.isFacetActive(ComponentStateFacet.SELECTION)); } }
Example #5
Source File: GraphiteSunsetSkin.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates a new <code>Graphite Sunset</code> skin. */ public GraphiteSunsetSkin() { super(new AccentBuilder() .withAccentResource("org/pushingpixels/substance/api/skin/graphite.colorschemes") .withActiveControlsAccent(new SunsetColorScheme()) .withHighlightsAccent(new SunsetColorScheme())); // Sunset needs tweaks for the enabled / disabled visuals of checkbox and radio button marks // for better contrast defaultSchemeBundle.registerColorScheme(this.getActiveControlsAccent(), ColorSchemeAssociationKind.MARK, ComponentState.SELECTED); defaultSchemeBundle.registerAlpha(0.7f, ComponentState.DISABLED_SELECTED); defaultSchemeBundle.registerColorScheme(this.getActiveControlsAccent().shade(0.4), ColorSchemeAssociationKind.MARK, ComponentState.DISABLED_SELECTED); }
Example #6
Source File: JTreeAdapterBreadCrumbTest.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Main method for testing. * * @param args Ignored. */ public static void main(String... args) { SwingUtilities.invokeLater(() -> { JFrame.setDefaultLookAndFeelDecorated(true); SubstanceCortex.GlobalScope.setSkin(new BusinessSkin()); JTreeAdapterBreadCrumbTest test = new JTreeAdapterBreadCrumbTest(); test.setIconImage(RadianceLogo.getLogoImage( SubstanceCortex.GlobalScope.getCurrentSkin().getColorScheme( SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE, SubstanceSlices.ColorSchemeAssociationKind.FILL, ComponentState.ENABLED))); test.setSize(700, 400); test.setLocation(300, 100); test.setVisible(true); test.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }); }
Example #7
Source File: SubstancePopupMenuBorder.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities.getColorScheme(c, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED); Graphics2D g2d = (Graphics2D) g.create(); float borderThickness = SubstanceSizeUtils.getBorderStrokeWidth(); float borderDelta = borderThickness / 2.0f; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); g2d.setStroke( new BasicStroke(borderThickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); g2d.translate(x, y); SubstanceBorderPainter borderPainter = SubstanceCoreUtilities.getBorderPainter(c); Color outline = borderPainter.getRepresentativeColor(borderScheme); g2d.setColor(outline); g2d.draw(new Rectangle2D.Float(borderDelta, borderDelta, width - borderThickness, height - borderThickness)); g2d.dispose(); }
Example #8
Source File: SubstanceColorSchemeUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns the color scheme of the specified component. * * @param component Component. * @param componentState Component state. * @return Component color scheme. */ public static SubstanceColorScheme getColorScheme(Component component, ComponentState componentState) { Component orig = component; // special case - if the component is marked as flat and // it is in the default state, or it is a button // that is never painting its background - get the color scheme of the // parent boolean isButtonThatIsNeverPainted = ((component instanceof AbstractButton) && SubstanceCoreUtilities.isButtonNeverPainted((AbstractButton) component)); if (isButtonThatIsNeverPainted || (SubstanceCoreUtilities.hasFlatAppearance(component, false) && (componentState == ComponentState.ENABLED))) { component = component.getParent(); } SubstanceSkin skin = SubstanceCoreUtilities.getSkin(component); if (skin == null) { SubstanceCoreUtilities.traceSubstanceApiUsage(component, "Substance delegate used when Substance is not the current LAF"); } SubstanceColorScheme nonColorized = skin.getColorScheme(component, componentState); return getColorizedScheme(orig, nonColorized, !componentState.isDisabled()); }
Example #9
Source File: SubstanceListUI.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns the current state for the specified cell. * * @param cellIndex Cell index. * @param rendererComponent Renderer component for the specified cell index. * @return The current state for the specified cell. */ public ComponentState getCellState(int cellIndex, Component rendererComponent) { boolean isEnabled = this.list.isEnabled(); if (rendererComponent != null) { isEnabled = isEnabled && rendererComponent.isEnabled(); } StateTransitionTracker tracker = this.stateTransitionMultiTracker.getTracker(cellIndex); if (tracker == null) { boolean isRollover = (rolledOverIndex >= 0) && (rolledOverIndex == cellIndex); boolean isSelected = selectedIndices.containsKey(cellIndex); return ComponentState.getState(isEnabled, isRollover, isSelected); } else { ComponentState fromTracker = tracker.getModelStateInfo().getCurrModelState(); return ComponentState.getState(isEnabled, fromTracker.isFacetActive(ComponentStateFacet.ROLLOVER), fromTracker.isFacetActive(ComponentStateFacet.SELECTION)); } }
Example #10
Source File: TestCommandButtonsSizing.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Main method for testing. * * @param args Ignored. */ public static void main(String[] args) { SwingUtilities.invokeLater(() -> { JFrame.setDefaultLookAndFeelDecorated(true); SubstanceCortex.GlobalScope.setSkin(new BusinessSkin()); JFrame frame = new JFrame("Testing command button fonts"); frame.setSize(800, 600); frame.setIconImage(RadianceLogo.getLogoImage( SubstanceCortex.GlobalScope.getCurrentSkin().getColorScheme( SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE, SubstanceSlices.ColorSchemeAssociationKind.FILL, ComponentState.ENABLED))); frame.add(new TestCommandButtonsSizing()); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }); }
Example #11
Source File: GeminiSkin.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
private static void applyHighlightAsFill(SubstanceColorSchemeBundle schemeBundle, SubstanceColorScheme highlightScheme, SubstanceColorScheme highlightBorderScheme) { // use for borders on rollover controls schemeBundle.registerColorScheme(highlightBorderScheme, ColorSchemeAssociationKind.BORDER, ComponentState.ROLLOVER_ARMED, ComponentState.ROLLOVER_SELECTED, ComponentState.ROLLOVER_UNSELECTED); // use for fill of selected controls schemeBundle.registerColorScheme(highlightScheme, ColorSchemeAssociationKind.FILL, ComponentState.SELECTED, ComponentState.ROLLOVER_SELECTED); // use for borders of highlights schemeBundle.registerColorScheme(highlightScheme, ColorSchemeAssociationKind.HIGHLIGHT_BORDER, ComponentState.getActiveStates()); // use for text highlight schemeBundle.registerColorScheme(highlightScheme, ColorSchemeAssociationKind.HIGHLIGHT_TEXT, ComponentState.SELECTED, ComponentState.ROLLOVER_SELECTED); // use for armed controls schemeBundle.registerColorScheme(highlightScheme, ComponentState.ARMED, ComponentState.ROLLOVER_ARMED); }
Example #12
Source File: SubstanceDefaultTableCellRenderer.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
private SubstanceColorScheme getColorSchemeForState(JTable table, SubstanceTableUI ui, ComponentState state) { UpdateOptimizationInfo updateOptimizationInfo = ui.getUpdateOptimizationInfo(); if (state == ComponentState.ENABLED) { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities.getColorScheme(table, state); } else { return updateOptimizationInfo.getDefaultScheme(); } } else { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities.getColorScheme(table, ColorSchemeAssociationKind.HIGHLIGHT, state); } else { return updateOptimizationInfo.getHighlightColorScheme(state); } } }
Example #13
Source File: SubstancePanelListCellRenderer.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
private SubstanceColorScheme getColorSchemeForState(JList list, SubstanceListUI ui, ComponentState state) { UpdateOptimizationInfo updateOptimizationInfo = ui.getUpdateOptimizationInfo(); if (state == ComponentState.ENABLED) { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities.getColorScheme(list, state); } else { return updateOptimizationInfo.getDefaultScheme(); } } else { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities.getColorScheme(list, SubstanceSlices.ColorSchemeAssociationKind.HIGHLIGHT, state); } else { return updateOptimizationInfo.getHighlightColorScheme(state); } } }
Example #14
Source File: SubstanceDefaultComboBoxRenderer.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
private SubstanceColorScheme getColorSchemeForState(JList list, int index, SubstanceListUI listUI, ComponentState state) { boolean toUseHighlightKindForCurrState = (index >= 0) && (state.isFacetActive(ComponentStateFacet.ROLLOVER) || state .isFacetActive(ComponentStateFacet.SELECTION)); UpdateOptimizationInfo updateOptimizationInfo = listUI .getUpdateOptimizationInfo(); if (toUseHighlightKindForCurrState) { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities.getColorScheme(list, ColorSchemeAssociationKind.HIGHLIGHT, state); } else { return updateOptimizationInfo.getHighlightColorScheme(state); } } else { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities .getColorScheme(list, state); } else { return updateOptimizationInfo.getDefaultScheme(); } } }
Example #15
Source File: FileExplorerStates.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Main method for testing. * * @param args Ignored. */ public static void main(String... args) { SwingUtilities.invokeLater(() -> { JFrame.setDefaultLookAndFeelDecorated(true); SubstanceCortex.GlobalScope.setSkin(new BusinessSkin()); FileExplorerStates test = new FileExplorerStates(); test.setIconImage(RadianceLogo.getLogoImage( SubstanceCortex.GlobalScope.getCurrentSkin().getColorScheme( SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE, SubstanceSlices.ColorSchemeAssociationKind.FILL, ComponentState.ENABLED))); test.setSize(500, 400); test.setLocationRelativeTo(null); test.setVisible(true); test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }); }
Example #16
Source File: SubstanceColorSchemeUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns the color scheme of the component. * * @param component Component. * @param associationKind Association kind. * @param componentState Component state. * @return Component color scheme. */ public static SubstanceColorScheme getColorScheme(Component component, ColorSchemeAssociationKind associationKind, ComponentState componentState) { // special case - if the component is marked as flat and // it is in the default state, get the color scheme of the parent. // However, flat toolbars should be ignored, since they are // the "top" level decoration area. if (!(component instanceof JToolBar) && SubstanceCoreUtilities.hasFlatAppearance(component, false) && (componentState == ComponentState.ENABLED)) { component = component.getParent(); } SubstanceSkin skin = SubstanceCoreUtilities.getSkin(component); if (skin == null) { return null; } SubstanceColorScheme nonColorized = skin.getColorScheme(component, associationKind, componentState); return getColorizedScheme(component, nonColorized, !componentState.isDisabled()); }
Example #17
Source File: SubstanceDefaultListCellRenderer.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
private SubstanceColorScheme getColorSchemeForState(JList list, SubstanceListUI ui, ComponentState state) { UpdateOptimizationInfo updateOptimizationInfo = ui.getUpdateOptimizationInfo(); if (state == ComponentState.ENABLED) { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities.getColorScheme(list, state); } else { return updateOptimizationInfo.getDefaultScheme(); } } else { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities.getColorScheme(list, ColorSchemeAssociationKind.HIGHLIGHT, state); } else { return updateOptimizationInfo.getHighlightColorScheme(state); } } }
Example #18
Source File: SubstanceTableHeaderUI.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns the grid color for the table header. * * @param header * Table header. * @return Grid color. */ protected static Color getGridColor(JTableHeader header) { boolean isEnabled = header.isEnabled(); if (header.getTable() != null) { // fix for issue 472 - handle standalone table headers isEnabled = isEnabled && header.getTable().isEnabled(); } ComponentState currState = isEnabled ? ComponentState.ENABLED : ComponentState.DISABLED_UNSELECTED; Color gridColor = SubstanceCoreUtilities.getSkin(header).getOverlayColor( SubstanceSlices.ColorOverlayType.LINE, DecorationPainterUtils.getDecorationType(header), currState); if (gridColor == null) { gridColor = SubstanceColorSchemeUtilities.getColorScheme( header, ColorSchemeAssociationKind.BORDER, currState).getLineColor(); } return gridColor; }
Example #19
Source File: SubstanceRibbonFrameTitlePane.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintComponent(Graphics g) { super.paintComponent(g); if (SubstanceCortex.ComponentScope.getCurrentSkin(this) .getOverlayPainters(DecorationAreaType.PRIMARY_TITLE_PANE).isEmpty()) { Graphics2D g2d = (Graphics2D) g.create(); SubstanceColorScheme compScheme = SubstanceColorSchemeUtilities.getColorScheme(this, ColorSchemeAssociationKind.SEPARATOR, ComponentState.ENABLED); Color sepColor = compScheme.isDark() ? SeparatorPainterUtils.getSeparatorShadowColor(compScheme) : SeparatorPainterUtils.getSeparatorDarkColor(compScheme); g2d.setColor(sepColor); float separatorThickness = SubstanceSizeUtils.getBorderStrokeWidth(); float separatorY = getHeight() - separatorThickness; g2d.setStroke(new BasicStroke(separatorThickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); g2d.draw(new Line2D.Double(0, separatorY, getWidth(), separatorY)); g2d.dispose(); } }
Example #20
Source File: SubstanceColorSelectorComponentUI.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override protected void paintRolloverIndication(Graphics g) { int w = this.colorSelectorComponent.getWidth(); int h = this.colorSelectorComponent.getHeight(); Graphics2D g2d = (Graphics2D) g.create(); float borderThickness = SubstanceSizeUtils.getBorderStrokeWidth(); g2d.setComposite(AlphaComposite.SrcOver.derive(this.rollover)); SubstanceColorScheme highlightBorderScheme = SubstanceColorSchemeUtilities.getColorScheme( this.colorSelectorComponent, ColorSchemeAssociationKind.HIGHLIGHT_BORDER, ComponentState.ROLLOVER_UNSELECTED); g2d.setColor(highlightBorderScheme.getMidColor()); g2d.draw(new Rectangle2D.Double(0, 0, w - borderThickness, h - borderThickness)); g2d.setColor(highlightBorderScheme.getUltraDarkColor()); g2d.draw(new Rectangle2D.Double(borderThickness, borderThickness, w - 3 * borderThickness, h - 3 * borderThickness)); g2d.dispose(); }
Example #21
Source File: TimelineBodyPanel.java From jpexs-decompiler with GNU General Public License v3.0 | 5 votes |
public static Color getSelectedColor() { if (Configuration.useRibbonInterface.get()) { return SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getBackgroundFillColor(); } else { return SystemColor.textHighlight; } }
Example #22
Source File: GeminiSkin.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Applies the specified highlight schemes on the relevant parts of the * specified scheme bundle. * * @param schemeBundle * Scheme bundle. * @param highlightScheme * Highlight scheme. * @param highlightBorderScheme * Highlight border scheme. */ private static void applyHighlightColorScheme(SubstanceColorSchemeBundle schemeBundle, SubstanceColorScheme highlightScheme, SubstanceColorScheme highlightBorderScheme) { // specify custom alpha values for the highlights schemeBundle.registerHighlightAlpha(0.85f, ComponentState.ROLLOVER_UNSELECTED); schemeBundle.registerHighlightAlpha(0.9f, ComponentState.SELECTED); schemeBundle.registerHighlightAlpha(1.0f, ComponentState.ROLLOVER_SELECTED, ComponentState.ARMED, ComponentState.ROLLOVER_ARMED); schemeBundle.registerHighlightColorScheme(highlightScheme, ComponentState.ROLLOVER_UNSELECTED, ComponentState.SELECTED, ComponentState.ROLLOVER_SELECTED, ComponentState.ARMED, ComponentState.ROLLOVER_ARMED); }
Example #23
Source File: UpdateOptimizationInfo.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
public SubstanceColorScheme getFillColorScheme(ComponentState state) { if (state == ComponentState.ENABLED) { return this.defaultScheme; } if (this.fillSchemeMap == null) { this.fillSchemeMap = new HashMap<>(); } SubstanceColorScheme result = this.fillSchemeMap.get(state); if (result == null) { result = SubstanceColorSchemeUtilities.getColorScheme( this.component, state); this.fillSchemeMap.put(state, result); } return result; }
Example #24
Source File: SubstanceDefaultTreeCellRenderer.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
private SubstanceColorScheme getColorSchemeForState(JTree tree, SubstanceTreeUI ui, ComponentState activeState) { SubstanceColorScheme scheme = (activeState == ComponentState.ENABLED) ? ui.getDefaultColorScheme() : SubstanceColorSchemeUtilities.getColorScheme(tree, ColorSchemeAssociationKind.HIGHLIGHT, activeState); if (scheme == null) { scheme = SubstanceColorSchemeUtilities.getColorScheme(tree, ColorSchemeAssociationKind.HIGHLIGHT, activeState); } return scheme; }
Example #25
Source File: SubstanceCommandButtonUI.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static Color getMenuButtonForegroundColor(AbstractCommandButton menuButton, StateTransitionTracker.ModelStateInfo modelStateInfo) { ComponentState currState = modelStateInfo.getCurrModelStateNoSelection(); Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo .getStateNoSelectionContributionMap(); SubstanceSlices.ColorSchemeAssociationKind currAssocKind = SubstanceSlices.ColorSchemeAssociationKind.FILL; // use HIGHLIGHT on active and non-rollover menu items if (!currState.isDisabled() && (currState != ComponentState.ENABLED) && !currState.isFacetActive(SubstanceSlices.ComponentStateFacet.ROLLOVER)) currAssocKind = SubstanceSlices.ColorSchemeAssociationKind.HIGHLIGHT; SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities.getColorScheme(menuButton, currAssocKind, currState); if (currState.isDisabled() || (activeStates == null) || (activeStates.size() == 1)) { return colorScheme.getForegroundColor(); } float aggrRed = 0; float aggrGreen = 0; float aggrBlue = 0; for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates .entrySet()) { ComponentState activeState = activeEntry.getKey(); float alpha = activeEntry.getValue().getContribution(); SubstanceSlices.ColorSchemeAssociationKind assocKind = SubstanceSlices.ColorSchemeAssociationKind.FILL; // use HIGHLIGHT on active and non-rollover menu items if (!activeState.isDisabled() && (activeState != ComponentState.ENABLED) && !activeState.isFacetActive(SubstanceSlices.ComponentStateFacet.ROLLOVER)) assocKind = SubstanceSlices.ColorSchemeAssociationKind.HIGHLIGHT; SubstanceColorScheme activeColorScheme = SubstanceColorSchemeUtilities .getColorScheme(menuButton, assocKind, activeState); Color activeForeground = activeColorScheme.getForegroundColor(); aggrRed += alpha * activeForeground.getRed(); aggrGreen += alpha * activeForeground.getGreen(); aggrBlue += alpha * activeForeground.getBlue(); } return new Color((int) aggrRed, (int) aggrGreen, (int) aggrBlue); }
Example #26
Source File: SubstanceCommandButtonUI.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Computes the alpha value for painting the separators. * * @return Alpha value for painting the separators. */ private float getSeparatorAlpha() { ComponentState actionAreaState = this.getActionTransitionTracker().getModelStateInfo() .getCurrModelState(); if (!actionAreaState.isFacetActive(ComponentStateFacet.SELECTION) && !actionAreaState.isDisabled()) { float actionRolloverCycle = this.getActionTransitionTracker() .getFacetStrength(ComponentStateFacet.ROLLOVER); float popupRolloverCycle = this.getPopupTransitionTracker() .getFacetStrength(ComponentStateFacet.ROLLOVER); return Math.min(1.0f, actionRolloverCycle + popupRolloverCycle); } return 1.0f; }
Example #27
Source File: UpdateOptimizationInfo.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
public SubstanceColorScheme getHighlightBorderColorScheme( ComponentState state) { if (this.highlightBorderSchemeMap == null) { this.highlightBorderSchemeMap = new HashMap<>(); } SubstanceColorScheme result = this.highlightBorderSchemeMap.get(state); if (result == null) { result = SubstanceColorSchemeUtilities.getColorScheme( this.component, ColorSchemeAssociationKind.HIGHLIGHT_BORDER, state); this.highlightBorderSchemeMap.put(state, result); } return result; }
Example #28
Source File: SampleFrame.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected void synchronize() { SwingUtilities.invokeLater(() -> { if (UIManager.getLookAndFeel() instanceof SubstanceLookAndFeel) { SampleFrame.this .setIconImage(RadianceLogo.getLogoImage(SubstanceCortex.ComponentScope .getCurrentSkin(SampleFrame.this.getRootPane()) .getColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED))); } }); }
Example #29
Source File: GraphiteChalkSkin.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Creates a new <code>Graphite Chalk</code> skin. */ public GraphiteChalkSkin() { SubstanceSkin.ColorSchemes schemes = SubstanceSkin.getColorSchemes( this.getClass().getClassLoader().getResourceAsStream( "org/pushingpixels/substance/api/skin/graphite.colorschemes")); SubstanceColorScheme chalkScheme = schemes.get("Chalk"); defaultSchemeBundle.registerColorScheme(chalkScheme, ColorSchemeAssociationKind.TAB_BORDER, ComponentState.getActiveStates()); defaultSchemeBundle.registerColorScheme(chalkScheme, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED); defaultSchemeBundle.registerColorScheme(chalkScheme, ColorSchemeAssociationKind.BORDER, ComponentState.getActiveStates()); defaultSchemeBundle.registerAlpha(0.5f, ComponentState.DISABLED_UNSELECTED, ComponentState.DISABLED_SELECTED, ComponentState.DISABLED_DEFAULT); defaultSchemeBundle.registerColorScheme(chalkScheme, ColorSchemeAssociationKind.BORDER, ComponentState.DISABLED_UNSELECTED, ComponentState.DISABLED_SELECTED, ComponentState.DISABLED_DEFAULT); defaultSchemeBundle.registerColorScheme(chalkScheme, ColorSchemeAssociationKind.HIGHLIGHT_BORDER, ComponentState.getActiveStates()); SubstanceColorScheme markScheme = schemes.get("Graphite Mark"); defaultSchemeBundle.registerColorScheme(markScheme, ColorSchemeAssociationKind.MARK); SubstanceColorScheme separatorScheme = schemes.get("Chalk Separator"); defaultSchemeBundle.registerColorScheme(separatorScheme, ColorSchemeAssociationKind.SEPARATOR, ComponentState.ENABLED); this.borderPainter = new ClassicBorderPainter(); }
Example #30
Source File: UpdateOptimizationInfo.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
public float getHighlightAlpha(ComponentState state) { if (this.highlightAlphaMap == null) { this.highlightAlphaMap = new HashMap<>(); } if (!this.highlightAlphaMap.containsKey(state)) { this.highlightAlphaMap.put(state, SubstanceColorSchemeUtilities .getHighlightAlpha(this.component, state)); } return this.highlightAlphaMap.get(state); }