@Override protected void uninstallDefaults() { DecorationPainterUtils.clearDecorationType(this.menuBar); super.uninstallDefaults(); }
/** * Returns the decoration area type of the specified component. The * component and its ancestor hierarchy are scanned for the registered * decoration area type. If * {@link #setDecorationType(JComponent, DecorationAreaType)} has been * called on the specified component, the matching decoration type is * returned. Otherwise, the component hierarchy is scanned to find the * closest ancestor that was passed to * {@link #setDecorationType(JComponent, DecorationAreaType)} - and its * decoration type is returned. If neither the component, nor any one of its * parent components has been passed to the setter method, * {@link DecorationAreaType#NONE} is returned. * * @param comp * Component. * @return Decoration area type of the component. */ public static DecorationAreaType getDecorationType(Component comp) { return DecorationPainterUtils.getDecorationType(comp); }
/** * Returns the immediate decoration area type of the specified component. * The component is checked for the registered decoration area type. If * {@link #setDecorationType(JComponent, DecorationAreaType, boolean)} was * not called on this component, this method returns <code>null</code>. * * @param comp * Component. * @return Immediate decoration area type of the component. */ public static DecorationAreaType getImmediateDecorationType(Component comp) { return DecorationPainterUtils.getImmediateDecorationType(comp); }
/** * 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); }
/** * Sets the decoration type of the specified component and all its children. * * @param comp * Component. * @param type * Decoration type of the component and all its children. */ public static void setDecorationType(JComponent comp, DecorationAreaType type) { DecorationPainterUtils.setDecorationType(comp, type); }
/** * 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); }
/** * Sets the decoration type of the specified component and all its children. * * @param comp * Component. * @param type * Decoration type of the component and all its children. */ public static void setDecorationType(JComponent comp, DecorationAreaType type) { DecorationPainterUtils.setDecorationType(comp, type); }
@Override protected void uninstallDefaults() { DecorationPainterUtils.clearDecorationType(this.menuBar); super.uninstallDefaults(); }
public void paint(Graphics2D g, Object jxTitledPanel, int width, int height) { JComponent titledPanel = (JComponent) jxTitledPanel; Graphics2D g2d = (Graphics2D) g.create(); // g2d.translate(10, 10); DecorationAreaType decorationType = SubstanceLookAndFeel .getDecorationType(titledPanel); if ((decorationType != null) && (SubstanceCoreUtilities.getSkin(titledPanel) .isRegisteredAsDecorationArea(decorationType))) { DecorationPainterUtils.paintDecorationBackground(g2d, titledPanel, false); } else { BackgroundPaintingUtils.fillAndWatermark(g2d, titledPanel, SubstanceCoreUtilities.getSkin(titledPanel) .getBackgroundColorScheme(decorationType) .getBackgroundFillColor(), new Rectangle(0, 0, titledPanel.getWidth(), titledPanel .getHeight())); } g2d.dispose(); } };
/** * Returns the immediate decoration area type of the specified component. * The component is checked for the registered decoration area type. If * {@link #setDecorationType(javax.swing.JComponent, DecorationAreaType)} was * not called on this component, this method returns <code>null</code>. * * @param comp * Component. * @return Immediate decoration area type of the component. */ public static DecorationAreaType getImmediateDecorationType(Component comp) { return DecorationPainterUtils.getImmediateDecorationType(comp); }
/** * Returns the decoration area type of the specified component. The * component and its ancestor hierarchy are scanned for the registered * decoration area type. If * {@link #setDecorationType(JComponent, DecorationAreaType)} has been * called on the specified component, the matching decoration type is * returned. Otherwise, the component hierarchy is scanned to find the * closest ancestor that was passed to * {@link #setDecorationType(JComponent, DecorationAreaType)} - and its * decoration type is returned. If neither the component, nor any one of its * parent components has been passed to the setter method, * {@link DecorationAreaType#NONE} is returned. * * @param comp * Component. * @return Decoration area type of the component. */ public static DecorationAreaType getDecorationType(Component comp) { return DecorationPainterUtils.getDecorationType(comp); }
@Override protected void uninstallDefaults(JXTitledPanel titledPanel) { DecorationPainterUtils.clearDecorationType(topPanel); super.uninstallDefaults(titledPanel); } }
.paintDecorationBackground(graphics, c, decorationType, force);
public static Component getTopMostParentWithDecorationAreaType( Component comp, DecorationAreaType type) { Component c = comp; Component topMostWithSameDecorationAreaType = c; while (c != null) { if (DecorationPainterUtils.getImmediateDecorationType(c) == type) { topMostWithSameDecorationAreaType = c; } c = c.getParent(); } return topMostWithSameDecorationAreaType; } }
@Override protected void uninstallDefaults() { DecorationPainterUtils.clearDecorationType(this.toolBar); super.uninstallDefaults(); }
.paintDecorationBackground(graphics, c, force);
@Override public void paintOverlay(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { Color shadowColor = SubstanceColorUtilities .getBackgroundFillColor(comp).darker(); // need to handle components "embedded" in other components Component c = comp; Component topMostWithSameDecorationAreaType = c; while (c != null) { if (DecorationPainterUtils.getImmediateDecorationType(c) == decorationAreaType) { topMostWithSameDecorationAreaType = c; } c = c.getParent(); } 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, 160), 0, 4, SubstanceColorUtilities .getAlphaColor(shadowColor, 16))); g2d.fillRect(0, 0, comp.getWidth(), 4); g2d.dispose(); }
@Override protected void uninstallDefaults(JXStatusBar sb) { DecorationPainterUtils.clearDecorationType(sb); super.uninstallDefaults(sb); }
@Override public void paintOverlay(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { Component c = comp; Component topMostWithSameDecorationAreaType = c; while (c != null) { if (DecorationPainterUtils.getImmediateDecorationType(c) == decorationAreaType) { topMostWithSameDecorationAreaType = c; } c = c.getParent(); } // Point inTopMost = SwingUtilities.convertPoint(comp, new Point(0, 0), // topMostWithSameDecorationAreaType); // int dy = inTopMost.y; int fontSize = SubstanceSizeUtils.getComponentFontSize(comp); float borderStrokeWidth = SubstanceSizeUtils .getBorderStrokeWidth(fontSize); graphics.setStroke(new BasicStroke(borderStrokeWidth)); SubstanceColorScheme colorScheme = // skin.getColorScheme(comp, // ColorSchemeAssociationKind.SEPARATOR, ComponentState.DEFAULT); // colorScheme = skin.getBackgroundColorScheme(decorationAreaType); graphics.setColor(this.colorSchemeQuery.query(colorScheme)); graphics.drawLine(0, topMostWithSameDecorationAreaType.getHeight() - (int) borderStrokeWidth, width, topMostWithSameDecorationAreaType.getHeight() - (int) borderStrokeWidth); }
@Override public void uninstallUI(JComponent c) { DecorationPainterUtils.clearDecorationType(this.titleBar); super.uninstallUI(c); }