creating and moving images

Hi, I would like to make a game as hobby in Java but have no clue of anything. Can anyone show me how to create and move the images? I don't know how to show an image in window but I do know about JComponents and actionListeners such as mouse and key. Thank you.
[270 byte] By [jeevan25a] at [2007-11-27 5:10:48]
# 1

look at the image and applet api and then create an image with the getImage method in the applet api

once youve created it, paint it in the paint method

to paint:

g.drawImage(Image imageName, int xPosition, int yPosition, Component? imageProducer/**u can just use this*/);

then youll prolly hav a speed variable.

just do things like

xPosition += xSpeed;

and

yPosition += ySpeed;

then the update method to make it not flash... rememb to add Graphics dbg as an instance variable...

public void update(Graphics g)

{

if (dbImage == null)

{

dbImage = createImage (this.getSize().width, this.getSize().height);

dbg = dbImage.getGraphics ();

}

dbg.setColor (getBackground ());

dbg.fillRect (0, 0, this.getSize().width, this.getSize().height);

dbg.setColor (getForeground());

paint (dbg);

g.drawImage (dbImage, 0, 0, this);

}

stephensk8sa at 2007-7-12 10:31:02 > top of Java-index,Security,Cryptography...