@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { final Graphics2D g2d = (Graphics2D) g; final Insets ins = getBorderInsets(c); final int yOff = (ins.top + ins.bottom) / 4; final boolean square = DarculaButtonUI.isSquare(c); int offset = JBUI.scale(square ? 1 : getOffset()); if (c.hasFocus()) { DarculaUIUtil.paintFocusRing(g2d, offset, yOff, width - 2 * offset, height - 2 * yOff); } else { final GraphicsConfig config = new GraphicsConfig(g); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT); g2d.setPaint( UIUtil.getGradientPaint( width / 2, y + yOff + 1, Gray._80.withAlpha(90), width / 2, height - 2 * yOff, Gray._90.withAlpha(90))); // g.drawRoundRect(x + offset + 1, y + yOff + 1, width - 2 * offset, height - 2*yOff, 5, 5); ((Graphics2D) g).setPaint(Gray._100.withAlpha(180)); g.drawRoundRect( x + offset, y + yOff, width - 2 * offset, height - 2 * yOff, JBUI.scale(square ? 3 : 5), JBUI.scale(square ? 3 : 5)); config.restore(); } }
@Override public void paint(Graphics g) { super.paint(g); if (myTextField.isFocusOwner() || (getPopup() != null && getPopup().isPopupVisible())) { if (isUsingDarculaUIFlavor()) { DarculaUIUtil.paintFocusRing(g, 3, 3, getWidth() - 4, getHeight() - 4); } } }