Link to home
Start Free TrialLog in
Avatar of Unimatrix_001
Unimatrix_001Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Loading a gif using awt??

Hi everybody,

can anybody give me a shove in the right direction?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Image image = Toolkit.getDefaultToolkit().createImage("yourGif.gif");
in an applet: Image image1 = getImage(<Url (ie. getCodeBase())>, "pic1.gif");

in an application: Image image1 = Toolkit.getDefaultToolkit().getImage(<URL>) OR Toolkit.getDefaultToolkit().getImage(<path>)

then you could put something like this in your paint method:
g.drawImage(image1, 0, 0, null); which will draw your image at 0,0 coordinate
Avatar of Unimatrix_001

ASKER

ooph! Looks like I'm splitting points here! :D....does both of those methods sorta like count in it being loaded into a frame?

sorta like, frame.add(image);

can I do that?
ASKER CERTIFIED SOLUTION
Avatar of bobbit31
bobbit31
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok thanks...I'll request a point split.
Avatar of modulo
modulo

Dear Unimatrix_001

I've refunded 20 points to enable you to accept the comment for one expert and to post a
"Points for <expertname>" Q for the other expert in the same topic area.

Please:
1) Post the link to the original Q in the "Points for <expertname>" and
2) Add in the original Q a comment with the link to the "Points for <expertname>", thus the email notif will warn the expert.

modulo

Community Support Moderator
Experts Exchange
> Thank you Bobbit!

no prob ;)