void (Component c, Graphics g, int x, int y) { if (g instanceof Graphics2D) { if (myBackground != null) { g.setColor(myBackground); FILL.paint((Graphics2D)g, x, y, getIconWidth(), getIconHeight(), myRound); } if (withBorders && myBorderColor != null) { g.setColor(myBorderColor); DRAW.paint((Graphics2D)g, x, y, getIconWidth(), getIconHeight(), myRound); } } Rectangle bounds = getTextBounds(); if (myForeground != null && bounds != null) { Graphics2D g2d = (Graphics2D)g.create(myInsets.left + x, myInsets.top + y, bounds.width, bounds.height); try { Object textLcdContrast = UIManager.get(RenderingHints.KEY_TEXT_LCD_CONTRAST); if (textLcdContrast == null) textLcdContrast = getLcdContrastValue(); // L&F is not properly updated g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, myContext.getAntiAliasingHint()); g2d.setRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST, textLcdContrast); g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, myContext.getFractionalMetricsHint()); g2d.setColor(myForeground); g2d.setFont(myFont); g2d.drawString(myText, -bounds.x, -bounds.y); } finally { g2d.dispose(); } } }