It’s for a pacman game and it works perfectly when I import it from my computer. But when I try to take it from an URL, my game starts lagging and the image doesn’t show.
URL url = new URL("https://www.dropbox.com/s/xpc49t8xpqt8dir/pacman%20down.jpg");
image = ImageIO.read(url);
G.drawImage(image, x, y, 20,20,null);
Image

( https://i.stack.imgur.com/Cp1XL.png at IMGUR )
I think that it may lag because the program downloads the image each time you draw it with your
Graphicsobject. You should use a cache system for your image or download it once for all the program execution.