I have this code:
import javax.swing.*;
import java.awt.*;
import java.net.MalformedURLException;
import java.net.URL;
public class main {
public static void main(String[] args) {
JFrame loadF = new JFrame("Loading");
loadF.setBounds(200, 200, 300 ,200);
loadF.getContentPane().setBackground(Color.YELLOW);
loadF.setLocationRelativeTo(null);
loadF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
loadF.setVisible(true);
JPanel loadP = new JPanel();
loadP.setBackground(Color.YELLOW);
loadP.setBounds(10, 10, 280, 180);
JLabel loadL = new JLabel("Loading... 0%");
loadP.add(loadL);
loadF.add(loadP);
//display here gif
}
}
And I want to add a gif of 100px to loadP.
Gif URL is https://piuksu.github.io/loading.GIF
How to do it?
I know this question may be a duplicate, but when I searched the internet I couldn't find the answer.
Thanks to google translation for translating.