/** * Computes whether the specified button has flat appearance. * * @param button * Button. * @return <code>true</code> if the button has flat appearance, * <code>false</code> otherwise. */ public static boolean hasFlatAppearance(AbstractButton button) { // small optimizations for checkboxes and radio buttons if (button instanceof JCheckBox) return false; if (button instanceof JRadioButton) return false; return ((SubstanceCoreUtilities.isToolBarButton(button) && SubstanceCoreUtilities .hasFlatAppearance(button, true)) || SubstanceCoreUtilities .hasFlatAppearance(button, false)); }
/** * Computes whether the specified button has flat appearance. * * @param button * Button. * @return <code>true</code> if the button has flat appearance, * <code>false</code> otherwise. */ public static boolean hasFlatAppearance(AbstractButton button) { // small optimizations for checkboxes and radio buttons if (button instanceof JCheckBox) return false; if (button instanceof JRadioButton) return false; return ((SubstanceCoreUtilities.isToolBarButton(button) && SubstanceCoreUtilities .hasFlatAppearance(button, true)) || SubstanceCoreUtilities .hasFlatAppearance(button, false)); }
/** * 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(); } SubstanceColorScheme nonColorized = SubstanceCoreUtilities.getSkin( component).getColorScheme(component, associationKind, componentState); return getColorizedScheme(component, nonColorized, !componentState .isDisabled()); }
/** * 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(); } SubstanceColorScheme nonColorized = SubstanceCoreUtilities.getSkin( component).getColorScheme(component, associationKind, componentState); return getColorizedScheme(component, nonColorized, !componentState .isDisabled()); }
/** * Returns the color scheme of the component. * * @param component * Component. * @param componentState * Component state. * @return Component color scheme. */ public static SubstanceColorScheme getActiveColorScheme( Component component, 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(); } SubstanceColorScheme nonColorized = SubstanceCoreUtilities.getSkin( component).getActiveColorScheme( SubstanceLookAndFeel.getDecorationType(component)); return getColorizedScheme(component, nonColorized, !componentState .isDisabled()); }
/** * 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 getActiveColorScheme( Component component, 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(); } SubstanceColorScheme nonColorized = SubstanceCoreUtilities.getSkin( component).getActiveColorScheme( SubstanceLookAndFeel.getDecorationType(component)); return getColorizedScheme(component, nonColorized, !componentState .isDisabled()); }
/** * Returns the scroll button state. * * @param scrollButton * Scroll button. * @return Scroll button state. */ protected ComponentState getState(JButton scrollButton) { if (scrollButton == null) return null; ComponentState result = ((TransitionAwareUI) scrollButton.getUI()) .getTransitionTracker().getModelStateInfo().getCurrModelState(); if ((result == ComponentState.ENABLED) && SubstanceCoreUtilities.hasFlatAppearance(this.scrollbar, false)) { result = null; } if (SubstanceCoreUtilities.isButtonNeverPainted(scrollButton)) { result = null; } return result; }
.isButtonNeverPainted((AbstractButton) component)); if (isButtonThatIsNeverPainted || (SubstanceCoreUtilities.hasFlatAppearance(component, false) && (componentState == ComponentState.ENABLED))) { component = component.getParent();
/** * Returns the scroll button state. * * @param scrollButton * Scroll button. * @return Scroll button state. */ protected ComponentState getState(JButton scrollButton) { if (scrollButton == null) return null; ComponentState result = ((TransitionAwareUI) scrollButton.getUI()) .getTransitionTracker().getModelStateInfo().getCurrModelState(); if ((result == ComponentState.ENABLED) && SubstanceCoreUtilities.hasFlatAppearance(this.scrollbar, false)) { result = null; } if (SubstanceCoreUtilities.isButtonNeverPainted(scrollButton)) { result = null; } return result; }
.isButtonNeverPainted((AbstractButton) component)); if (isButtonThatIsNeverPainted || (SubstanceCoreUtilities.hasFlatAppearance(component, false) && (componentState == ComponentState.ENABLED))) { component = component.getParent();
boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(button); boolean isSpecial = isFlat || !button.isEnabled(); float extraAlpha = 1.0f;
boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(button); boolean isSpecial = isFlat || !button.isEnabled(); float extraAlpha = 1.0f;
boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(combo, false); boolean isSpecial = isFlat || !combo.isEnabled(); float extraAlpha = 1.0f;
boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(combo, false); boolean isSpecial = isFlat || !combo.isEnabled(); float extraAlpha = 1.0f;
@Override public void paint(Graphics g) { if (SubstanceCoreUtilities.hasFlatAppearance(this.splitPane, true)) { BackgroundPaintingUtils.updateIfOpaque(g, this.splitPane);
@Override public void paint(Graphics g) { if (SubstanceCoreUtilities.hasFlatAppearance(this.splitPane, true)) { BackgroundPaintingUtils.updateIfOpaque(g, this.splitPane);
boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(button); boolean isSpecial = isFlat || !button.isEnabled(); float extraAlpha = 1.0f;
boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(button); boolean isSpecial = isFlat || !button.isEnabled(); float extraAlpha = 1.0f;