• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# [java] images in java games

## 1 post in this topic

hi i am trying to make a game in java , it is going to be a 2D iso game to be played over the net for FREE. i have been looking at the AWT , java2D , JAI to find the red tread in java image handling, but i cant seem to find it. i really need good advice to the use of images in java. if i use to many features in the 3 API''s , my performance get hanged. thanks Dennis
0

##### Share on other sites
Hello;
Here''s how to use images in java (in an applet) :
  //First delcare an image object (in java.awt.image):Image img;//Then in your init method of the applet gif or jpg images...public void init() { img = getImage("path/image.gif"); // or .. this gets the image where the code (class file) is. img = getImage(getCodeBase(),"image.gif"); }//then if you want to draw it on the screen...public void paint(Graphics g) { g.drawImage(img,x,y,null);}

In the above code I''m assuming your planning to write an applet (you said "played over the net").
I suggest you use AWT because java2d is not supported on the browers (yet - without the plugin).
For full documentation on AWT go here.
Look for the Graphics class and Image class.

I hoped this helped a little ().

=============================
silly programmer vb is for kids.
============================
www.thejpsystem.com
0