Loading an Image

Discussion in 'Java' started by mohed.haidar@gmail.com, Jan 2, 2008.

  1. Guest

    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.
     
    , Jan 2, 2008
    #1
    1. Advertising

  2. On Jan 2, 2:53 am, 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
     
    Owen Jacobson, Jan 2, 2008
    #2
    1. Advertising

  3. Owen Jacobson wrote:
    > On Jan 2, 2:53 am, 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
     
    Knute Johnson, Jan 2, 2008
    #3
  4. In swing all the stuff u nead is in the imageIO package

    javax.imageio.ImageIO.load(...);
     
    Chase Preuninger, Jan 2, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laszlo Zsolt Nagy
    Replies:
    1
    Views:
    1,432
    Kartic
    Jan 26, 2005
  2. David Segall
    Replies:
    2
    Views:
    461
    Thomas Kellerer
    Jan 2, 2007
  3. Replies:
    4
    Views:
    338
  4. edfialk
    Replies:
    0
    Views:
    211
    edfialk
    May 10, 2007
  5. ofir
    Replies:
    0
    Views:
    200
Loading...

Share This Page