• Post Reply Bookmark Topic Watch Topic
  • New Topic

imageIcon width = -1  RSS feed

jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys : Im loading an image icon but it comes up blank.
To debug it, Ive tried reading it in as a stream :

Now, when I read the stream in as a byte array, I get that the length of the byte[] is equal to the bytes of the image - so I know the path is correct and also that it is being read in correctly from the stream.

However, when i do new ImageIcon(getBytes(is)).getWidth() returns the
value -1. Of course, my application displays no image because of this.

How can I debug an ImageIcon ? This is a very strange problem because
the image is clearly seen by java and is read in correctly.
Michael Dunn
Ranch Hand
Posts: 4632
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!