Importing a pic
Author |
Message |
xHoly-Divinity
|
Posted: 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
|
|
|
rizzix
|
Posted: 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]
|
Posted: 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
|
Posted: 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 |
|
|
|
|
|
|
|