void (Graphics g) { //if (myPaintingBgNow) return; if (isOpaque()) { Container parent = getParent(); JComponent opaque = null; if (parent instanceof JComponent) { opaque = (JComponent)UIUtil.findNearestOpaque(parent); } Color bg = opaque == null ? UIUtil.getPanelBackground() : opaque.getBackground(); g.setColor(bg); g.fillRect(0, 0, getWidth(), getHeight()); } Icon icon; if (animator.isRunning()) { icon = icons[currentIconIndex]; } else { icon = getPassiveIcon(); } Rectangle bounds = new Rectangle(getWidth(), getHeight()); JBInsets.removeFrom(bounds, getInsets()); bounds.x += (bounds.width - icon.getIconWidth()) / 2; bounds.y += (bounds.height - icon.getIconHeight()) / 2; paintIcon(g, icon, bounds.x, bounds.y); }