
-----------------------------------
xHoly-Divinity
Sat Oct 29, 2005 1:44 pm

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.

-----------------------------------
rizzix
Sat Oct 29, 2005 2:21 pm


-----------------------------------
 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]
Sun Dec 28, 2008 11:47 pm

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 [url=http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/BufferedImage.html]this as the first result, which tells you that BufferedImage is in java.awt.image.

-----------------------------------
TheHobbit
Sun Dec 28, 2008 11:57 pm

Re: Importing a pic
-----------------------------------
haha, oh jeez, i didnt even look at the time stamps, my bad :o
