+ 1

how to run an gif in java swing

18th Nov 2016, 4:16 PM
Ayush chadha
Ayush chadha - avatar
3 odpowiedzi
+ 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);   } }
18th Nov 2016, 4:23 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 1
thanks aditya kumar pandet
18th Nov 2016, 4:49 PM
Ayush chadha
Ayush chadha - avatar
+ 1
pandey sorry
18th Nov 2016, 4:49 PM
Ayush chadha
Ayush chadha - avatar