954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to import a picture Applet

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.

sirlink99
Practically a Master Poster
661 posts since Oct 2010
Reputation Points: 45
Solved Threads: 19
 

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
http://www.realapplets.com/tutorial/ImageExample.html

kramerd
Posting Pro in Training
403 posts since Sep 2010
Reputation Points: 49
Solved Threads: 73
 

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?

sirlink99
Practically a Master Poster
661 posts since Oct 2010
Reputation Points: 45
Solved Threads: 19
 

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.

kramerd
Posting Pro in Training
403 posts since Sep 2010
Reputation Points: 49
Solved Threads: 73
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: