How do I use one image use it many times as I like.
like for shooting..
can someone give me a sample code for it
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
How do I use one image use it many times as I like.
like for shooting..
can someone give me a sample code for it
If this is Swing (you don't say), you can create an ImageIcon and use the ImageIcon in many locations. Or you can create a BufferedImage in many locations by drawing it in many locations.
This statement is confusing to me. Like for shooting? shooting what?...like for shooting..
Sample code of what exactly? There are plenty of sample programs to peruse on this and other sites. What confuses you in particular?can someone give me a sample code for it
Please clarify your question.
shooting ====>>> like space invaders it shoots laser with the same image and it moves
sample code ==>>> sample code for using the image as a shooting material that create a new image when the other first one is released.
OK. I'd use ImageIcons and pop them into whatever JLabel needs to display the image.
This is going to need to come from you I'm afraid. We'll help you work on it, but the code will need to be yours. Again, there are plenty of animation examples to be found here and in other forums, and I invite you to have a look for them, but I doubt any of the volunteers is going to want to create a new example when many good examples already exist. Also, most examples I've seen here have been generated in response to helping fix someone else's code, and I'm not sure you're at that stage yet as I'm guessing you haven't created a nearly working example yet.sample code ==>>> sample code for using the image as a shooting material that create a new image when the other first one is released.
I already me a spacejet image that goies back and fourth using the KeyListener also it shoot one image at a time. thats the only thing I need to fixe for now. can you find me a link on a good example for it if you have time..
Thank you.