/** * Paints the decoration background on the specified component. The * decoration background is not painted when the <code>force</code> * parameter is <code>false</code> and at least one of the following * conditions holds: * <ul> * <li>The component is in a cell renderer.</li> * <li>The component is not showing on the screen.</li> * <li>The component is in the preview mode.</li> * </ul> * * @param g * Graphics context. * @param c * Component. * @param force * If <code>true</code>, the painting of decoration background is * enforced. */ public static void paintDecorationBackground(Graphics g, Component c, boolean force) { DecorationAreaType decorationType = SubstanceLookAndFeel .getDecorationType(c); paintDecorationBackground(g, c, decorationType, force); }
/** * Paints the decoration background on the specified component. The * decoration background is not painted when the <code>force</code> * parameter is <code>false</code> and at least one of the following * conditions holds: * <ul> * <li>The component is in a cell renderer.</li> * <li>The component is not showing on the screen.</li> * <li>The component is in the preview mode.</li> * </ul> * * @param g * Graphics context. * @param c * Component. * @param force * If <code>true</code>, the painting of decoration background is * enforced. */ public static void paintDecorationBackground(Graphics g, Component c, boolean force) { DecorationAreaType decorationType = SubstanceLookAndFeel .getDecorationType(c); paintDecorationBackground(g, c, decorationType, force); }
public void paint(JComponent component, Graphics2D graphics, boolean paintSeparator) { BackgroundPaintingUtils.updateIfOpaque(graphics, component); if (paintSeparator) { SubstanceSkin skin = SubstanceLookAndFeel.getCurrentSkin(component); DecorationAreaType decorationAreaType = SubstanceLookAndFeel .getDecorationType(component); List<SubstanceOverlayPainter> overlayPainters = skin .getOverlayPainters(decorationAreaType); // only if there are no overlays specified on this decoration area // type in the skin if (overlayPainters.size() == 0) { // paint the separator on top. SeparatorPainterUtils.paintSeparator(component, graphics, component.getWidth(), 0, JSeparator.HORIZONTAL, false, 0); } } } }
public DecorationAreaType getThisDecorationType() { DecorationAreaType dat = SubstanceLookAndFeel.getDecorationType(this); if (dat == DecorationAreaType.PRIMARY_TITLE_PANE) { return SubstanceCoreUtilities.isPaintRootPaneActivated(getRootPane()) ? DecorationAreaType.PRIMARY_TITLE_PANE : DecorationAreaType.PRIMARY_TITLE_PANE_INACTIVE; } else if (dat == DecorationAreaType.SECONDARY_TITLE_PANE) { return SubstanceCoreUtilities.isPaintRootPaneActivated(getRootPane()) ? DecorationAreaType.SECONDARY_TITLE_PANE : DecorationAreaType.SECONDARY_TITLE_PANE_INACTIVE; } else { return dat; } }
public DecorationAreaType getThisDecorationType() { DecorationAreaType dat = SubstanceLookAndFeel.getDecorationType(this); if (dat == DecorationAreaType.PRIMARY_TITLE_PANE) { return SubstanceCoreUtilities.isPaintRootPaneActivated(frame.getRootPane()) ? DecorationAreaType.PRIMARY_TITLE_PANE : DecorationAreaType.PRIMARY_TITLE_PANE_INACTIVE; } else if (dat == DecorationAreaType.SECONDARY_TITLE_PANE) { return SubstanceCoreUtilities.isPaintRootPaneActivated(frame.getRootPane()) ? DecorationAreaType.SECONDARY_TITLE_PANE : DecorationAreaType.SECONDARY_TITLE_PANE_INACTIVE; } else { return dat; } }
public UpdateOptimizationInfo(JComponent component) { this.component = component; this.toDrawWatermark = SubstanceCoreUtilities .toDrawWatermark(this.component); this.defaultScheme = SubstanceColorSchemeUtilities.getColorScheme( this.component, ComponentState.ENABLED); this.decorationAreaType = SubstanceLookAndFeel .getDecorationType(this.component); SubstanceSkin skin = SubstanceCoreUtilities.getSkin(this.component); this.isInDecorationArea = (this.decorationAreaType != null) && skin.isRegisteredAsDecorationArea(this.decorationAreaType) && SubstanceCoreUtilities.isOpaque(this.component); }
public UpdateOptimizationInfo(JComponent component) { this.component = component; this.toDrawWatermark = SubstanceCoreUtilities .toDrawWatermark(this.component); this.defaultScheme = SubstanceColorSchemeUtilities.getColorScheme( this.component, ComponentState.ENABLED); this.decorationAreaType = SubstanceLookAndFeel .getDecorationType(this.component); SubstanceSkin skin = SubstanceCoreUtilities.getSkin(this.component); this.isInDecorationArea = (this.decorationAreaType != null) && skin.isRegisteredAsDecorationArea(this.decorationAreaType) && SubstanceCoreUtilities.isOpaque(this.component); }
@Override public void run() { if (editorPane == null) return; Color foregr = editorPane.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { editorPane .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(editorPane) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(editorPane)))); } } });
@Override public void run() { if (textField == null) return; Color foregr = textField.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textField .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textField) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textField)))); } } });
@Override public void run() { if (textField == null) return; Color foregr = textField.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textField .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textField) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textField)))); } } });
@Override public void run() { if (passwordField == null) return; Color foregr = passwordField.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { passwordField .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(passwordField) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(passwordField)))); } } });
@Override public void run() { if (passwordField == null) return; Color foregr = passwordField.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { passwordField .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(passwordField) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(passwordField)))); } } });
@Override public void run() { if (textField == null) return; Color foregr = textField.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textField .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textField) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textField)))); } } });
@Override public void run() { if (textPane == null) return; Color foregr = textPane.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textPane .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textPane) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textPane)))); } } });
@Override public void run() { if (textField == null) return; Color foregr = textField.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textField .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textField) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textField)))); } } });
@Override public void run() { if (textPane == null) return; Color foregr = textPane.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textPane .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textPane) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textPane)))); } } });
@Override public void run() { if (editorPane == null) return; Color foregr = editorPane.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { editorPane .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(editorPane) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(editorPane)))); } } });
@Override public void run() { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) return; if (textArea == null) return; Color foregr = textArea.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textArea .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textArea) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textArea)))); } } });
@Override public void run() { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) return; if (textArea == null) return; Color foregr = textArea.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textArea .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textArea) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textArea)))); } } });
/** * Returns the default background color for the specified component. * * @param comp * Component. * @param compState * Component state. * @return The default background color for the components of the specified * class. */ public static ColorUIResource getDefaultBackgroundColor(Component comp, ComponentState compState) { if (comp instanceof JTextComponent) { // special case for text-based components return new ColorUIResource(SubstanceColorSchemeUtilities .getColorScheme(comp, compState) .getTextBackgroundFillColor()); } return new ColorUIResource(SubstanceLookAndFeel.getCurrentSkin(comp) .getBackgroundColorScheme( SubstanceLookAndFeel.getDecorationType(comp)) .getBackgroundFillColor()); }