void (Graphics g) { Color bg = getBackground(); if (bg == null) { bg = UIUtil.getPanelBackground(); } g.setColor(bg); if (isOpaque()) { g.fillRect(0,0, getWidth() - 1, getHeight()-1); } final Border border = getBorder(); final Insets insets = border == null ? new Insets(0,0,0,0) : border.getBorderInsets(this); int x = (getWidth() - insets.left - insets.right - myIcon.getIconWidth()) / 2; int y = insets.top; myIcon.paintIcon(this, g, x, y); g.setFont(getFont()); y += myIcon.getIconHeight(); final FontMetrics metrics = getFontMetrics(getFont()); x = (getWidth() - insets.left - insets.right - metrics.stringWidth(myLabel)) / 2; y += metrics.getHeight() * 3 / 2; g.setColor(UIUtil.getLabelForeground()); GraphicsUtil.setupAAPainting(g); g.drawString(myLabel, x, y); }