void (final Component component, Graphics g, int x, int y) { Graphics2D g2d = (Graphics2D)g.create(); final GraphicsConfig config = GraphicsUtil.setupAAPainting(g2d); try { final int w = getIconWidth(); final int h = getIconHeight(); if (myColors.length == 2) { g2d.setPaint(getPaint(myColors[0])); g2d.fillPolygon(new int[]{x, x + w, x}, new int[]{y, y, y + h}, 3); g2d.setPaint(getPaint(myColors[1])); g2d.fillPolygon(new int[]{x + w, x + w, x}, new int[]{y, y + h, y + h}, 3); } else { for (int i = 0; i < myColors.length; i++) { g2d.setPaint(getPaint(myColors[i])); RectanglePainter.FILL.paint(g2d, i % 2 == 0 ? x : x + w / 2 + 1, i < 2 ? y : y + h / 2 + 1, w / 2 - 1, h / 2 - 1, null); if (i ==3) break; } } } catch (Exception e) { g2d.dispose(); } finally { config.restore(); } }