void (Graphics g) { if (g instanceof Graphics2D g2d && gradient.isSelected()) { Rectangle bounds = new Rectangle(getWidth(), getHeight()); g2d.setPaint(new LinearGradientPaint( bounds.x, bounds.y, bounds.width, bounds.height, new float[]{0, 1}, new Color[]{JBColor.LIGHT_GRAY, JBColor.DARK_GRAY})); g2d.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); } else { super.paintComponent(g); } }