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()); } }
public void squish(Graphics g, ImageIcon icon, int x, int y, double scale) { if (isVisible()) { g.drawImage( icon.getImage(), x, y, (int) (icon.getIconWidth() * scale), (int) (icon.getIconHeight() * scale), this); } }