+ 1
how to run an gif in java swing
3 Respostas
+ 3
use below code
import java.awt.*;
import javax.swing.JFrame;
public class CanvasExample extends Canvas {
public void paint(Graphics g) {
Toolkit t = Toolkit.getDefaultToolkit();
Image i = t.getImage("Your image link");
g.drawImage(i, 10, 10, this);
}
public static void main(String[] args) {
CanvasExample m = new CanvasExample();
JFrame f = new JFrame("Canvas Example");
f.add(m);
f.setSize(300, 300);
f.setVisible(true);
}
}
+ 1
thanks aditya kumar pandet
+ 1
pandey sorry