Hi, I would like to insert the image bomb.png in a random screen position in each 5 seconds(not delete the previous and insert again after 5 seconds, is to add another one) . Can someane help me?
import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JPanel; public class Board extends JPanel { Image bomb; public Board() { ImageIcon ii = new ImageIcon(this.getClass().getResource("bomb.png")); bomb = ii.getImage(); } public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.drawImage(bomb, x, y, null); // x, y are random positions on the screen, } }