I am in a java programming class but my teacher doesn't teach anything so could someone please explain to me how to import a picture into the applet and give me an example of a simple script that just imports a picture. I have learned how to use the mouse and the graphics and all of that.


Thanks.

BTW I'm going to try to make a slider puzzle.

Recommended Answers

Not sure this is what you are looking for, but here are a couple links that might help.
http://www.exampledepot.com/egs/java.applet/LoadImageApplet.html

Jump to Post

All 3 Replies

I am in a java programming class but my teacher doesn't teach anything so could someone please explain to me how to import a picture into the applet and give me an example of a simple script that just imports a picture. I have learned how to use the mouse and the graphics and all of that.


Thanks.

BTW I'm going to try to make a slider puzzle.

I would like to add the picture from a file not a website and is there a way to re-size the image?

The 2nd link I sent shows how to load an image from a file. You can call getScaledInstance to resize the image. See the documentation for more details.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.