1,105,331 Community Members

How to import a picture Applet

Member Avatar
sirlink99
Master Poster
766 posts since Oct 2010
Reputation Points: 44 [?]
Q&As Helped to Solve: 25 [?]
Skill Endorsements: 3 [?]
 
0
 

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.

Member Avatar
kramerd
Posting Pro in Training
404 posts since Sep 2010
Reputation Points: 29 [?]
Q&As Helped to Solve: 75 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
sirlink99
Master Poster
766 posts since Oct 2010
Reputation Points: 44 [?]
Q&As Helped to Solve: 25 [?]
Skill Endorsements: 3 [?]
 
0
 

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?

Member Avatar
kramerd
Posting Pro in Training
404 posts since Sep 2010
Reputation Points: 29 [?]
Q&As Helped to Solve: 75 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: