javax.swing.plaf.UIResource Java Examples

The following examples show how to use javax.swing.plaf.UIResource. 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: DarkListUIBridge.java    From darklaf with MIT License 6 votes vote down vote up
/**
 * Sets the list properties that have not been explicitly overridden to {@code null}. A property is considered
 * overridden if its current value is not a {@code UIResource}.
 *
 * @see #installDefaults
 * @see #uninstallUI
 * @see CellRendererPane
 */
protected void uninstallDefaults() {
    LookAndFeel.uninstallBorder(list);
    if (list.getFont() instanceof UIResource) {
        list.setFont(null);
    }
    if (list.getForeground() instanceof UIResource) {
        list.setForeground(null);
    }
    if (list.getBackground() instanceof UIResource) {
        list.setBackground(null);
    }
    if (list.getSelectionBackground() instanceof UIResource) {
        list.setSelectionBackground(null);
    }
    if (list.getSelectionForeground() instanceof UIResource) {
        list.setSelectionForeground(null);
    }
    if (list.getCellRenderer() instanceof UIResource) {
        list.setCellRenderer(null);
    }
    if (list.getTransferHandler() instanceof UIResource) {
        list.setTransferHandler(null);
    }
}
 
Example #2
Source File: FlatButtonUI.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
protected void paintText( Graphics g, AbstractButton b, Rectangle textRect, String text ) {
	if( isHelpButton( b ) )
		return;

	if( defaultBoldText && isDefaultButton( b ) && b.getFont() instanceof UIResource ) {
		Font boldFont = g.getFont().deriveFont( Font.BOLD );
		g.setFont( boldFont );

		int boldWidth = b.getFontMetrics( boldFont ).stringWidth( text );
		if( boldWidth > textRect.width ) {
			textRect.x -= (boldWidth - textRect.width) / 2;
			textRect.width = boldWidth;
		}
	}

	paintText( g, b, textRect, text, getForeground( b ) );
}
 
Example #3
Source File: FlatRootPaneUI.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
protected void installDefaults( JRootPane c ) {
	super.installDefaults( c );

	// Update background color of JFrame or JDialog parent to avoid bad border
	// on HiDPI screens when switching from light to dark Laf.
	// The background of JFrame is initialized in JFrame.frameInit() and
	// the background of JDialog in JDialog.dialogInit(),
	// but it was not updated when switching Laf.
	Container parent = c.getParent();
	if( parent instanceof JFrame || parent instanceof JDialog ) {
		Color background = parent.getBackground();
		if( background == null || background instanceof UIResource )
			parent.setBackground( UIManager.getColor( "control" ) );
	}

	// enable dark window appearance on macOS when running in JetBrains Runtime
	if( SystemInfo.IS_JETBRAINS_JVM && SystemInfo.IS_MAC_OS_10_14_MOJAVE ) {
		LookAndFeel laf = UIManager.getLookAndFeel();
		boolean isDark = laf instanceof FlatLaf && ((FlatLaf)laf).isDark();
		c.putClientProperty( "jetbrains.awt.windowDarkAppearance", isDark );
	}
}
 
Example #4
Source File: SynthStyle.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Uninstalls any state that this style installed on
 * the <code>JComponent</code> from <code>context</code>.
 * <p>
 * Styles should NOT depend upon this being called, in certain cases
 * it may never be called.
 *
 * @param context SynthContext identifying component to install properties
 *        to.
 */
public void uninstallDefaults(SynthContext context) {
    if (!context.isSubregion()) {
        // NOTE: because getForeground, getBackground and getFont will look
        // at the parent Container, if we set them to null it may
        // mean we they return a non-null and non-UIResource value
        // preventing install from correctly settings its colors/font. For
        // this reason we do not uninstall the fg/bg/font.

        JComponent c = context.getComponent();
        Border border = c.getBorder();

        if (border instanceof UIResource) {
            c.setBorder(null);
        }
    }
}
 
Example #5
Source File: AquaTabbedPaneContrastUI.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected void paintTitle(final Graphics2D g2d, final Font font, final FontMetrics metrics, final Rectangle textRect, final int tabIndex, final String title) {
    final View v = getTextViewForTab(tabIndex);
    if (v != null) {
        v.paint(g2d, textRect);
        return;
    }

    if (title == null) return;

    final Color color = tabPane.getForegroundAt(tabIndex);
    if (color instanceof UIResource) {
        g2d.setColor(getNonSelectedTabTitleColor());
        if (tabPane.getSelectedIndex() == tabIndex) {
            boolean pressed = isPressedAt(tabIndex);
            boolean enabled = tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex);
            Color textColor = getSelectedTabTitleColor(enabled, pressed);
            Color shadowColor = getSelectedTabTitleShadowColor(enabled);
            AquaUtils.paintDropShadowText(g2d, tabPane, font, metrics, textRect.x, textRect.y, 0, 1, textColor, shadowColor, title);
            return;
        }
    } else {
        g2d.setColor(color);
    }
    g2d.setFont(font);
    SwingUtilities2.drawString(tabPane, g2d, title, textRect.x, textRect.y + metrics.getAscent());
}
 
Example #6
Source File: NimbusIcon.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public int getIconWidth(SynthContext context) {
    if (context == null) {
        return width;
    }
    JComponent c = context.getComponent();
    if (c instanceof JToolBar && ((JToolBar)c).getOrientation() == JToolBar.VERTICAL) {
        //we only do the -1 hack for UIResource borders, assuming
        //that the border is probably going to be our border
        if (c.getBorder() instanceof UIResource) {
            return c.getWidth() - 1;
        } else {
            return c.getWidth();
        }
    } else {
        return scale(context, width);
    }
}
 
Example #7
Source File: AquaTabbedPaneContrastUI.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void paintTitle(final Graphics2D g2d, final Font font, final FontMetrics metrics, final Rectangle textRect, final int tabIndex, final String title) {
    final View v = getTextViewForTab(tabIndex);
    if (v != null) {
        v.paint(g2d, textRect);
        return;
    }

    if (title == null) return;

    final Color color = tabPane.getForegroundAt(tabIndex);
    if (color instanceof UIResource) {
        g2d.setColor(getNonSelectedTabTitleColor());
        if (tabPane.getSelectedIndex() == tabIndex) {
            boolean pressed = isPressedAt(tabIndex);
            boolean enabled = tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex);
            Color textColor = getSelectedTabTitleColor(enabled, pressed);
            Color shadowColor = getSelectedTabTitleShadowColor(enabled);
            AquaUtils.paintDropShadowText(g2d, tabPane, font, metrics, textRect.x, textRect.y, 0, 1, textColor, shadowColor, title);
            return;
        }
    } else {
        g2d.setColor(color);
    }
    g2d.setFont(font);
    SwingUtilities2.drawString(tabPane, g2d, title, textRect.x, textRect.y + metrics.getAscent());
}
 
Example #8
Source File: FontDefaultsInitTask.java    From darklaf with MIT License 6 votes vote down vote up
private Font fontWithRule(final Font font, final FontSizeRule rule) {
    if (font == null) return null;
    float size = font.getSize2D();
    float newSize = rule.adjustFontSize(size);
    if (newSize == size) return font;
    if (newSize <= 0) {
        LOGGER.warning("Font " + font + " would be invisible after applying " + rule + ". Font won't be changed!");
        return font;
    }
    Font withRule = font.deriveFont(newSize);
    if (font instanceof UIResource
        && !(withRule instanceof UIResource)) {
        withRule = new DarkFontUIResource(withRule);
    }
    return withRule;
}
 
Example #9
Source File: DarkButtonUI.java    From darklaf with MIT License 6 votes vote down vote up
protected void paintButtonBackground(final Graphics g, final JComponent c) {
    Graphics2D g2 = (Graphics2D) g;
    AbstractButton b = (AbstractButton) c;
    if (shouldDrawBackground(b)) {
        int arc = getArc(c);
        int width = c.getWidth();
        int height = c.getHeight();
        Insets margin = b.getMargin();
        if (margin instanceof UIResource) margin = new Insets(0, 0, 0, 0);
        if (ButtonConstants.isBorderlessVariant(c)) {
            paintBorderlessBackground(b, g2, arc, width, height, margin);
        } else {
            paintDefaultBackground(b, g2, arc, width, height);
        }
    }
}
 
Example #10
Source File: AquaUtils.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
static void fillRect(final Graphics g, final Component c, final Color color,
                     final int x, final int y, final int w, final int h) {
    if (!(g instanceof Graphics2D)) {
        return;
    }
    final Graphics2D cg = (Graphics2D) g.create();
    try {
        if (color instanceof UIResource && isWindowTextured(c)
                && color.equals(SystemColor.window)) {
            cg.setComposite(AlphaComposite.Src);
            cg.setColor(resetAlpha(color));
        } else {
            cg.setColor(color);
        }
        cg.fillRect(x, y, w, h);
    } finally {
        cg.dispose();
    }
}
 
Example #11
Source File: DarkSpinnerUI.java    From darklaf with MIT License 6 votes vote down vote up
private JButton createArrow(final int direction) {
    int buttonPad = UIManager.getInt("Spinner.buttonPad");
    Insets insets = new Insets(0, buttonPad, 0, buttonPad);
    JButton button = ArrowButton.createUpDownArrow(spinner,
                                                   getArrowIcon(direction),
                                                   getArrowInactiveIcon(direction), direction,
                                                   false, true, insets);
    Border buttonBorder = UIManager.getBorder("Spinner.arrowButtonBorder");
    if (buttonBorder instanceof UIResource) {
        // Wrap the border to avoid having the UIResource be replaced by
        // the ButtonUI. This is the opposite of using BorderUIResource.
        button.setBorder(new CompoundBorder(buttonBorder, null));
    } else {
        button.setBorder(buttonBorder);
    }
    button.setInheritsPopupMenu(true);
    return button;
}
 
Example #12
Source File: NimbusDefaults.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private DerivedColor getDerivedColor(String uin, String parentUin,
                                    float hOffset, float sOffset,
                                    float bOffset, int aOffset,
                                    boolean uiResource) {
    DerivedColor color;
    if (uiResource) {
        color = new DerivedColor.UIResource(parentUin,
                hOffset, sOffset, bOffset, aOffset);
    } else {
        color = new DerivedColor(parentUin, hOffset, sOffset,
            bOffset, aOffset);
    }

    if (derivedColors.containsKey(color)) {
        return derivedColors.get(color);
    } else {
        derivedColors.put(color, color);
        color.rederiveColor(); /// move to ARP.decodeColor() ?
        colorTree.addColor(uin, color);
        return color;
    }
}
 
Example #13
Source File: AquaFocusHandler.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
static void swapSelectionColors(final String prefix, final JList c, final Object value) {
    if (!isComponentValid(c)) return;

    final Color bg = c.getSelectionBackground();
    final Color fg = c.getSelectionForeground();
    if (!(bg instanceof UIResource) || !(fg instanceof UIResource)) return;

    if (Boolean.FALSE.equals(value)) {
        setSelectionColors(c, "List.selectionInactiveForeground", "List.selectionInactiveBackground");
        return;
    }

    if (Boolean.TRUE.equals(value)) {
        setSelectionColors(c, "List.selectionForeground", "List.selectionBackground");
        return;
    }
}
 
Example #14
Source File: NimbusIcon.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
@Override
public int getIconHeight(SynthContext context) {
    if (context == null) {
        return height;
    }
    JComponent c = context.getComponent();
    if (c instanceof JToolBar){
        JToolBar toolbar = (JToolBar)c;
        if (toolbar.getOrientation() == JToolBar.HORIZONTAL) {
            //we only do the -1 hack for UIResource borders, assuming
            //that the border is probably going to be our border
            if (toolbar.getBorder() instanceof UIResource) {
                return c.getHeight() - 1;
            } else {
                return c.getHeight();
            }
        } else {
            return scale(context, width);
        }
    } else {
        return scale(context, height);
    }
}
 
Example #15
Source File: SynthTreeUI.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void uninstallDefaults() {
    SynthContext context = getContext(tree, ENABLED);

    style.uninstallDefaults(context);
    context.dispose();
    style = null;

    context = getContext(tree, Region.TREE_CELL, ENABLED);
    cellStyle.uninstallDefaults(context);
    context.dispose();
    cellStyle = null;


    if (tree.getTransferHandler() instanceof UIResource) {
        tree.setTransferHandler(null);
    }
}
 
Example #16
Source File: AquaFocusHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static void swapSelectionColors(final String prefix, final JTable c, final Object value) {
    if (!isComponentValid(c)) return;

    final Color bg = c.getSelectionBackground();
    final Color fg = c.getSelectionForeground();
    if (!(bg instanceof UIResource) || !(fg instanceof UIResource)) return;

    if (Boolean.FALSE.equals(value)) {
        setSelectionColors(c, "Table.selectionInactiveForeground", "Table.selectionInactiveBackground");
        return;
    }

    if (Boolean.TRUE.equals(value)) {
        setSelectionColors(c, "Table.selectionForeground", "Table.selectionBackground");
        return;
    }
}
 
Example #17
Source File: AquaUtils.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static void fillRect(final Graphics g, final Component c, final Color color,
                     final int x, final int y, final int w, final int h) {
    if (!(g instanceof Graphics2D)) {
        return;
    }
    final Graphics2D cg = (Graphics2D) g.create();
    try {
        if (color instanceof UIResource && isWindowTextured(c)
                && color.equals(SystemColor.window)) {
            cg.setComposite(AlphaComposite.Src);
            cg.setColor(resetAlpha(color));
        } else {
            cg.setColor(color);
        }
        cg.fillRect(x, y, w, h);
    } finally {
        cg.dispose();
    }
}
 
Example #18
Source File: NimbusIcon.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
@Override
public int getIconWidth(SynthContext context) {
    if (context == null) {
        return width;
    }
    JComponent c = context.getComponent();
    if (c instanceof JToolBar && ((JToolBar)c).getOrientation() == JToolBar.VERTICAL) {
        //we only do the -1 hack for UIResource borders, assuming
        //that the border is probably going to be our border
        if (c.getBorder() instanceof UIResource) {
            return c.getWidth() - 1;
        } else {
            return c.getWidth();
        }
    } else {
        return scale(context, width);
    }
}
 
Example #19
Source File: FlatLaf.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
public Object createValue( UIDefaults table ) {
	Font defaultFont = UIManager.getFont( "defaultFont" );

	if( lastDefaultFont != defaultFont ) {
		lastDefaultFont = defaultFont;

		if( scaleFactor != 1 ) {
			// scale font
			int newFontSize = Math.round( defaultFont.getSize() * scaleFactor );
			font = new FontUIResource( defaultFont.deriveFont( (float) newFontSize ) );
		} else {
			// make sure that font is a UIResource for LaF switching
			font = (defaultFont instanceof UIResource)
				? defaultFont
				: new FontUIResource( defaultFont );
		}
	}

	return font;
}
 
Example #20
Source File: FlatButtonBorder.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
public Insets getBorderInsets( Component c, Insets insets ) {
	if( FlatButtonUI.isToolBarButton( c ) ) {
		// In toolbars, use button margin only if explicitly set.
		// Otherwise use toolbar margin specified in UI defaults.
		Insets margin = (c instanceof AbstractButton)
			? ((AbstractButton)c).getMargin()
			: null;

		FlatUIUtils.setInsets( insets, UIScale.scale( FlatUIUtils.addInsets( toolbarSpacingInsets,
			(margin != null && !(margin instanceof UIResource)) ? margin : toolbarMargin ) ) );
	} else {
		insets = super.getBorderInsets( c, insets );

		// use smaller left and right insets for icon-only or single-character buttons (so that they are square)
		if( FlatButtonUI.isIconOnlyOrSingleCharacterButton( c ) && ((AbstractButton)c).getMargin() instanceof UIResource )
			insets.left = insets.right = Math.min( insets.top, insets.bottom );
	}

	return insets;
}
 
Example #21
Source File: AquaFocusHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static void swapSelectionColors(final String prefix, final JList c, final Object value) {
    if (!isComponentValid(c)) return;

    final Color bg = c.getSelectionBackground();
    final Color fg = c.getSelectionForeground();
    if (!(bg instanceof UIResource) || !(fg instanceof UIResource)) return;

    if (Boolean.FALSE.equals(value)) {
        setSelectionColors(c, "List.selectionInactiveForeground", "List.selectionInactiveBackground");
        return;
    }

    if (Boolean.TRUE.equals(value)) {
        setSelectionColors(c, "List.selectionForeground", "List.selectionBackground");
        return;
    }
}
 
Example #22
Source File: XTextAreaPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example #23
Source File: UIDefaultsDump.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
private void dumpActiveValue( PrintWriter out, ActiveValue value ) {
	out.print( "[active] " );
	Object realValue = value.createValue( defaults );

	if( realValue instanceof Font && realValue == UIManager.getFont( "defaultFont" ) ) {
		// dump "$defaultFont" for the default font to make it easier to
		// compare Windows/Linux dumps with macOS dumps
		out.print( "$defaultFont" );
		if( realValue instanceof UIResource )
			out.print( " [UI]" );
	} else
		dumpValue( out, realValue );
}
 
Example #24
Source File: SwingUtilities.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convenience method to change the UI InputMap for <code>component</code>
 * to <code>uiInputMap</code>. If <code>uiInputMap</code> is {@code null},
 * this removes any previously installed UI InputMap.
 *
 * @since 1.3
 */
public static void replaceUIInputMap(JComponent component, int type,
                                     InputMap uiInputMap) {
    InputMap map = component.getInputMap(type, (uiInputMap != null));

    while (map != null) {
        InputMap parent = map.getParent();
        if (parent == null || (parent instanceof UIResource)) {
            map.setParent(uiInputMap);
            return;
        }
        map = parent;
    }
}
 
Example #25
Source File: FlatTextAreaUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void paintBackground( Graphics g ) {
	JTextComponent c = getComponent();

	Color background = c.getBackground();
	g.setColor( !(background instanceof UIResource)
		? background
		: (isIntelliJTheme && (!c.isEnabled() || !c.isEditable())
			? FlatUIUtils.getParentBackground( c )
			: (!c.isEnabled()
				? disabledBackground
				: (!c.isEditable() ? inactiveBackground : background))) );
	g.fillRect( 0, 0, c.getWidth(), c.getHeight() );
}
 
Example #26
Source File: JFormattedTextField.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Resets the Actions that come from the TextFormatter to
 * <code>actions</code>.
 */
private void setFormatterActions(Action[] actions) {
    if (actions == null) {
        if (textFormatterActionMap != null) {
            textFormatterActionMap.clear();
        }
    }
    else {
        if (textFormatterActionMap == null) {
            ActionMap map = getActionMap();

            textFormatterActionMap = new ActionMap();
            while (map != null) {
                ActionMap parent = map.getParent();

                if (parent instanceof UIResource || parent == null) {
                    map.setParent(textFormatterActionMap);
                    textFormatterActionMap.setParent(parent);
                    break;
                }
                map = parent;
            }
        }
        for (int counter = actions.length - 1; counter >= 0;
             counter--) {
            Object key = actions[counter].getValue(Action.NAME);

            if (key != null) {
                textFormatterActionMap.put(key, actions[counter]);
            }
        }
    }
}
 
Example #27
Source File: SwingUtilities.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Installs a {@code DropTarget} on the component as necessary for a
 * {@code TransferHandler} change.
 */
static void installSwingDropTargetAsNecessary(Component c,
                                                     TransferHandler t) {

    if (!getSuppressDropTarget()) {
        DropTarget dropHandler = c.getDropTarget();
        if ((dropHandler == null) || (dropHandler instanceof UIResource)) {
            if (t == null) {
                c.setDropTarget(null);
            } else if (!GraphicsEnvironment.isHeadless()) {
                c.setDropTarget(new TransferHandler.SwingDropTarget(c));
            }
        }
    }
}
 
Example #28
Source File: SwingUtilities.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the ActionMap provided by the UI
 * in component <code>component</code>.
 * <p>This will return {@code null} if the UI has not installed an ActionMap.
 *
 * @since 1.3
 */
public static ActionMap getUIActionMap(JComponent component) {
    ActionMap map = component.getActionMap(false);
    while (map != null) {
        ActionMap parent = map.getParent();
        if (parent instanceof UIResource) {
            return parent;
        }
        map = parent;
    }
    return null;
}
 
Example #29
Source File: MetalMenuBarUI.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * If necessary paints the background of the component, then
 * invokes <code>paint</code>.
 *
 * @param g Graphics to paint to
 * @param c JComponent painting on
 * @throws NullPointerException if <code>g</code> or <code>c</code> is
 *         null
 * @see javax.swing.plaf.ComponentUI#update
 * @see javax.swing.plaf.ComponentUI#paint
 * @since 1.5
 */
public void update(Graphics g, JComponent c) {
    boolean isOpaque = c.isOpaque();
    if (g == null) {
        throw new NullPointerException("Graphics must be non-null");
    }
    if (isOpaque && (c.getBackground() instanceof UIResource) &&
                    UIManager.get("MenuBar.gradient") != null) {
        if (MetalToolBarUI.doesMenuBarBorderToolBar((JMenuBar)c)) {
            JToolBar tb = (JToolBar)MetalToolBarUI.
                 findRegisteredComponentOfType(c, JToolBar.class);
            if (tb.isOpaque() &&tb.getBackground() instanceof UIResource) {
                MetalUtils.drawGradient(c, g, "MenuBar.gradient", 0, 0,
                                        c.getWidth(), c.getHeight() +
                                        tb.getHeight(), true);
                paint(g, c);
                return;
            }
        }
        MetalUtils.drawGradient(c, g, "MenuBar.gradient", 0, 0,
                                c.getWidth(), c.getHeight(),true);
        paint(g, c);
    }
    else {
        super.update(g, c);
    }
}
 
Example #30
Source File: FlatTextPaneUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void paintBackground( Graphics g ) {
	JTextComponent c = getComponent();

	// for compatibility with IntelliJ themes
	if( isIntelliJTheme && (!c.isEnabled() || !c.isEditable()) && (c.getBackground() instanceof UIResource) ) {
		FlatUIUtils.paintParentBackground( g, c );
		return;
	}

	super.paintBackground( g );
}