CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2003
    Location
    South Bend Indiana
    Posts
    105

    Creating an Image Icon With a .bmp Image

    Does anyone know how to create an ImageIcon object with a bitmp image file. For instance, with a gif image, I can create an Image Icon thus

    URL url = getClass().getResource("any.gif");
    ImageIcon icon = new ImageIcon(url);

    Now when I have a bitmap file called any.bmp I canot do the same as above. Why ??

    Thanks

    Melody

  2. #2
    Join Date
    Jan 2002
    Location
    Halifax, NS, Canada
    Posts
    985
    The ImageIcon class supports whatever the AWT Toolkit does. Which I think is only GIF, JPEG or PNG.

    But here's something you might be interested in
    http://www.esus.com/javaindex/j2se/j...p/javabmp.html

  3. #3
    Join Date
    Apr 2003
    Location
    Israel
    Posts
    398
    does your project prevents you from converting it into gif?
    Vision.

  4. #4
    Join Date
    Feb 2003
    Location
    South Bend Indiana
    Posts
    105
    Thanks Goodz and Ishabin. As for your question regarding whether or not I can am constrained not to convert to a GIF the answer is NO. If there is a way of converting to GIF without losing picture quality then please advise.

    Many thanks

  5. #5
    Join Date
    Apr 2003
    Location
    Cheltenham, UK
    Posts
    500

    Lightbulb

    Recent versions of Microsoft Paint will allow you to do this conversion.
    Live as if you were to die tomorrow. Learn as if you were to live forever.

  6. #6
    Join Date
    Oct 2003
    Location
    Hyderabad
    Posts
    18

    Bitmap compulsion

    Hey David is it necessary to convert the file into gif?? i mean is there any harm in continuing with a bitmap as i feel there are lot of code available that read a bitmap into a java program.
    just give a thought

    Thx
    Devanand.Ch

  7. #7
    Join Date
    Apr 2003
    Location
    Cheltenham, UK
    Posts
    500
    You can...I'd just take the path of least resistance...(convert them to GIFs).
    Live as if you were to die tomorrow. Learn as if you were to live forever.

  8. #8
    Join Date
    Oct 2003
    Location
    Hyderabad
    Posts
    18
    yaa thatz also true but i was talking in terms of limitations set by client that he want a bitmap only etc.anyway ur thought is very well accepted
    Thx
    Devanand.Ch

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured