boolean (Graphics2D g, JComponent c) { if (!((AbstractButton)c).isContentAreaFilled()) { return true; } Rectangle r = new Rectangle(c.getSize()); if(SegmentedActionToolbarComponent.Companion.isCustomBar(c)) { return SegmentedActionToolbarComponent.Companion.paintButtonDecorations(g, c, getBackground(c, r)); } JBInsets.removeFrom(r, isSmallVariant(c) || isGotItButton(c) ? c.getInsets() : JBUI.insets(1)); if (UIUtil.isHelpButton(c)) { g.setPaint(UIUtil.getGradientPaint(0, 0, getButtonColorStart(), 0, r.height, getButtonColorEnd())); int diam = HELP_BUTTON_DIAMETER.get(); int x = r.x + (r.width - diam) / 2; int y = r.x + (r.height - diam) / 2; g.fill(new Ellipse2D.Float(x, y, diam, diam)); AllIcons.Actions.Help.paintIcon(c, g, x + JBUIScale.scale(3), y + JBUIScale.scale(3)); return false; } else { Graphics2D g2 = (Graphics2D)g.create(); try { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, MacUIUtil.USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE); g2.translate(r.x, r.y); float bw = isSmallVariant(c) || isGotItButton(c) ? 0 : BW.getFloat(); float arc = isTag(c) ? r.height - bw * 2 : DarculaUIUtil.BUTTON_ARC.getFloat(); if (!c.hasFocus() && !isSmallVariant(c) && c.isEnabled() && UIManager.getBoolean("Button.paintShadow")) { Color shadowColor = JBColor.namedColor("Button.shadowColor", JBColor.namedColor("Button.darcula.shadowColor", new JBColor(new Color(0xa6a6a633, true), new Color(0x36363680, true)))); int shadowWidth = JBUIScale.scale(JBUI.getInt("Button.shadowWidth", 2)); g2.setColor(isDefaultButton(c) ? JBColor.namedColor("Button.default.shadowColor", shadowColor) : shadowColor); g2.fill(new RoundRectangle2D.Float(bw, bw + shadowWidth, r.width - bw * 2, r.height - bw * 2, arc, arc)); } if (c.isEnabled()) { Color outlineFocusColor = (Color)c.getClientProperty("JButton.outlineFocusColor"); Integer outlineFocusSize = (Integer)c.getClientProperty("JButton.outlineFocusSize"); if (outlineFocusColor != null && outlineFocusSize != null && c.hasFocus()) { g2.setPaint(outlineFocusColor); g2.fill(new RoundRectangle2D.Float(bw - outlineFocusSize, bw - outlineFocusSize, r.width - bw * 2 + outlineFocusSize * 2, r.height - bw * 2 + outlineFocusSize * 2, arc + outlineFocusSize, arc + outlineFocusSize)); } g2.setPaint(getBackground(c, r)); g2.fill(new RoundRectangle2D.Float(bw, bw, r.width - bw * 2, r.height - bw * 2, arc, arc)); } } finally { g2.dispose(); } return true; } }