• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading and displaying an image

 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can In read and display an image using Java.And,what must the image path be in this case?

Thanks.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Abder-Rahman Ali:
How can In read and display an image using Java.And,what must the image path be in this case?

Thanks.


Usually you use the Toolkit#getImage() method to retrieve the Image object. Then based on the requirement you can either use it directly or wrap it inside an ImageIcon and then use it.

The image path can be a String indicating the file, or a URL.
Do take a look at this article. especially the part regarding loading images. You might find it useful.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!