hey…
does anybody know an good graphic tutorial for java? For example…
…How can I draw jpg or gifs…
…what can I draw with java and what must I draw with graphic progs
hey…
does anybody know an good graphic tutorial for java? For example…
…How can I draw jpg or gifs…
…what can I draw with java and what must I draw with graphic progs
There are many, many ways to load images, but this is the most universal, and best way:
BufferedImage img = ImageIO.read(new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream("myimage.gif")));
Other ways include:
Image img = Toolkit.getDefaultToolkit().getImage("myimage.jpg");
Then in your paint or render method:
g.drawImage(img,0,0,this);
If you need more help than that, I suggest either reading more threads in this forum, which cover pretty much everything you could want to know about 2D graphics in java, or google for a beginners tutorial.