Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Applets
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
paul wheaton
Ron McLeod
Devaka Cooray
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Paul Clapham
Saloon Keepers:
Tim Holloway
Carey Brown
Piet Souris
Bartenders:
Forum:
Applets
Loading image to Applet
mahmoud bakar
Greenhorn
Posts: 5
posted 24 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i use jdk1.2 to compile
java
Applet
,Applet that deal with
image give me error alwyes..so i want to Know how can i make Applet load an image.
Stephanie Grasson
Ranch Hand
Posts: 347
posted 24 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Mahmoud,
Here is one approach (assuming your image file is named "sample.jpg":
import java.applet.*; import java.awt.*; public class ImageLoader extends Applet { public void paint(Graphics g) { Image theImage = getImage(getDocumentBase(), "sample.jpg"); g.drawImage(theImage, 0, 0, this); } }
Hope this helps.
Let us know if you still have problems.
Stephanie
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
image
applet issue
placing images in applets
problem while displaying multipage tiff image in applet
Create Image object
More...