java - how to load animated gif to jpanel from mac -
i want load animated gif jpanel read how when run program
i message:
java.net.malformedurlexception: no protocol: /users/me/documents/workspace/managetimeclock/images/timeanim.gif
i checked gif path , correct!!
so should do?
my code:
url url; try { url = new url("/users/me/documents/workspace/managetimeclock/images/timeanim.gif"); icon imggif = new imageicon(url); jlabel lblgif = new jlabel(); lblgif.seticon(imggif); lblgif.setbounds(100, 100, 400, 450); switchpanel.add(lblgif); } catch (malformedurlexception e1) { // todo auto-generated catch block e1.printstacktrace(); }
i solved thank anyway :)
solved with:
string path = "/users/me/documents/workspace/managetimeclock/images/timeanim.gif"; icon imggif = new imageicon(path); jlabel lblgif = new jlabel(); lblgif.seticon(imggif); lblgif.setbounds(150,150, 455, 170); switchpanel.add(lblgif);
Comments
Post a Comment