This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SetIconImage Question  RSS feed

 
Keith Davey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have want to set the icon for the application that I am building. Followed everything that I need to do ok. The problem that I am having is that the applicaiton hangs when I try to use a .gif file and will display the icon ok when I use a .jpg file. I thought that you could use a .gif file. Any thoughts to what is going on?
 
Tris Rabar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which icon are you setting? The frame icon? And how do you access the gif image??
 
Keith Davey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am setting the image on the JFrame using setIconImage:
frame.setIconImage(new ImageIcon("twticon.jpg").getImage());
Where the .jpg or .gif is in the same dir.
kmd
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi try this code it should work.

let me know if it was of any help.
Yoel
[ March 21, 2002: Message edited by: yoel stern ]
 
Tris Rabar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've tried both of the above ways with my application, and they work.
I'm not sure what could be your problem. Try Yoel's solution....let us know.
 
Keith Davey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Figured it out finally. For some reason if the image is too big when it is a gif file the program just hangs. Shrink it and it seems to work fine. No difference on a jpg file.
thanks for all the suggestions
kmd
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!