File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 42356
    
  64
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: 42356
    
  64
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: 42356
    
  64
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: 42356
    
  64
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: DISPLAY an IMAGE