This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes DISPLAY an IMAGE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "DISPLAY an IMAGE" Watch "DISPLAY an IMAGE" New topic
Author

DISPLAY an IMAGE

Zaafir Barahim
Ranch Hand

Joined: Dec 12, 2006
Posts: 36
i want to display an image which i have in a specific folder. i want to display that image using JAVA. please HELP me OUT!!!Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41144
    
  45
So you have an applet that loads an image from the web server from where it's hosted? If so, then this example applet may get you going.


Ping & DNS - my free Android networking tools app
Zaafir Barahim
Ranch Hand

Joined: Dec 12, 2006
Posts: 36
i just want to display an image using JAVA. no need to be use a web server. Just simple code to display an image
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41144
    
  45
In that case, the javax.imageio package will do nicely, as is shown here.

I'll move the topic to the AWT/Swing/GUI forum, since there's nothing applet-specific about the question.
Zaafir Barahim
Ranch Hand

Joined: Dec 12, 2006
Posts: 36
Thanks the code works. but i want to display 2 images, 1 big image as background and then another small image on the big image. please help me out for the code, thanks in advance!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41144
    
  45
In that case, first load and draw the background image, and then draw the front image on top of it.
Zaafir Barahim
Ranch Hand

Joined: Dec 12, 2006
Posts: 36
can i get a sample code which enable me to do this. im new on this topic. thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41144
    
  45
The first link I posted shows how to draw an image. Did you get that to work? If so, you can use a similar method call to draw the second image on top of it. You'd probably want to use different x and y coordinates, depending on the size on the images, and their desired locations.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: DISPLAY an IMAGE
 
Similar Threads
Displaying images on JSP page
image in netbeans
DISPLAYING several image
Display image in JSP
thumbnail in jsp