Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Loading an Image

Reply
Thread Tools

Loading an Image

 
 
mohed.haidar@gmail.com
Guest
Posts: n/a
 
      01-02-2008
Hello guys. I have been trying hard to load an Image but with no luck.
Basically I want an application that can take an Image (jpeg) from a
specified location on my disk and show it. I get confused with all the
canvas, paint, render ,update stuff that makes the task seam very
complicated when i feel that its not so. Any ideas ?? And also if you
guys would have a problem like mine how would you go about finding a
solution ?? Thank you for your time.
 
Reply With Quote
 
 
 
 
Owen Jacobson
Guest
Posts: n/a
 
      01-02-2008
On Jan 2, 2:53*am, (E-Mail Removed) wrote:
> Hello guys. I have been trying hard to load an Image but with no luck.
> Basically I want an application that can take an Image (jpeg) from a
> specified location on my disk and show it. I get confused with all the
> canvas, paint, render ,update stuff that makes the task seam very
> complicated when i feel that its not so. Any ideas ?? And also if you
> guys would have a problem like mine how would you go about finding a
> solution ?? Thank you for your time.


1. Use ImageIO to load the file into an Image object:
<http://java.sun.com/docs/books/tutorial/2d/images/loadimage.html>

2. Use the Image object to create an ImageIcon object.

3. Place the ImageIcon widget in a JLabel and add the label to your
window.

Check the javadocs on ImageIO, Image, ImageIcon, and JLabel for a
fairly thorough explanation of how all this fits together. The
tutorial link I gave you proposes a second way to do it, which is more
useful if you need to transform the image (scale, rotate, recolour,
alpha-blend, et cetera) before drawing it.

-o
 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      01-02-2008
Owen Jacobson wrote:
> On Jan 2, 2:53 am, (E-Mail Removed) wrote:
>> Hello guys. I have been trying hard to load an Image but with no luck.
>> Basically I want an application that can take an Image (jpeg) from a
>> specified location on my disk and show it. I get confused with all the
>> canvas, paint, render ,update stuff that makes the task seam very
>> complicated when i feel that its not so. Any ideas ?? And also if you
>> guys would have a problem like mine how would you go about finding a
>> solution ?? Thank you for your time.

>
> 1. Use ImageIO to load the file into an Image object:
> <http://java.sun.com/docs/books/tutorial/2d/images/loadimage.html>
>
> 2. Use the Image object to create an ImageIcon object.
>
> 3. Place the ImageIcon widget in a JLabel and add the label to your
> window.
>
> Check the javadocs on ImageIO, Image, ImageIcon, and JLabel for a
> fairly thorough explanation of how all this fits together. The
> tutorial link I gave you proposes a second way to do it, which is more
> useful if you need to transform the image (scale, rotate, recolour,
> alpha-blend, et cetera) before drawing it.
>
> -o


Also look here for some example code on how to load and display and image.

http://rabbitbrush.frazmtn.com

And I would use the ImageIO method not the others.

--

Knute Johnson
email s/nospam/knute/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
 
Reply With Quote
 
Chase Preuninger
Guest
Posts: n/a
 
      01-02-2008
In swing all the stuff u nead is in the imageIO package

javax.imageio.ImageIO.load(...);
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
order of iframe loading with document loading ofir Javascript 0 12-03-2007 12:06 PM
loading image -> detect when image is done loading edfialk Javascript 0 05-10-2007 07:28 PM
[OT] Is loading the second Java application faster than loading the first? David Segall Java 2 01-02-2007 04:41 PM
Image loading using javascript. Handling timeouts and parrallel loading under IE zborisau@gmail.com Javascript 4 08-28-2005 02:02 PM
wx.Image: Couldn't add an image to the image list. Laszlo Zsolt Nagy Python 1 01-26-2005 09:55 PM



Advertisments