void (Graphics g, JComponent c, Color color, boolean rounded) { Graphics2D g2 = (Graphics2D)g.create(); try { g2.setColor(color); Rectangle bounds = c.getVisibleRect(); if (rounded) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); int arc = JBUI.CurrentTheme.MainToolbar.Dropdown.hoverArc().get(); g2.fillRoundRect(bounds.x, bounds.y, bounds.width, bounds.height, arc, arc); } else { g2.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); } } finally { g2.dispose(); } }