public void paint(Graphics g) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); for (int i = 0; i < numImages; i++) { if (x[i] > 3 * i) { nudge(i); squish(g, icon[i], xh[i], yh[i], scale[i]); } else { x[i] += .05; y[i] += .05; } } }
public synchronized void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(Color.white); g.fillRect(0, 0, c.getWidth(), c.getHeight()); if (getImageObserver() == null) { g.drawImage( getImage(), c.getWidth() / 2 - getIconWidth() / 2, c.getHeight() / 2 - getIconHeight() / 2, c); } else { g.drawImage( getImage(), c.getWidth() / 2 - getIconWidth() / 2, c.getHeight() / 2 - getIconHeight() / 2, getImageObserver()); } }