Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Importing a pic
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xHoly-Divinity




PostPosted: Sat Oct 29, 2005 1:44 pm   Post subject: Importing a pic

Suppose I had a pic name "box.gif" and I am using hsa console (our teacher wants us to use it), how would I import this box image. Could someone give me an example of how to draw it.
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Sat Oct 29, 2005 2:21 pm   Post subject: (No subject)

code:
BufferedImage img = javax.imageio.ImageIO.read(new File("/path/to/image.gif"));
g.drawImage(img, x, y, null);


where g is ur graphics2d object
[Gandalf]




PostPosted: Sun Dec 28, 2008 11:47 pm   Post subject: RE:Importing a pic

In the future, don't necro post in old topics, especially ones over 3 years old like this one. Also, you can google the class in the future to find out what package it's located in:
Searching for: "java BufferedImage" gives you this as the first result, which tells you that BufferedImage is in java.awt.image.
TheHobbit




PostPosted: Sun Dec 28, 2008 11:57 pm   Post subject: Re: Importing a pic

haha, oh jeez, i didnt even look at the time stamps, my bad Surprised
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: