Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

change java icon swing  RSS feed

 
sanket karkare
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I change or remove the java icon at top left corner of a frame using swing or awt ?
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JFrame.setIconImage().
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to remove it, use an image that does not exist
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That doesn't remove an icon - it sets the default again.

You can create a transparent BufferedImage without any contents; that should work. The simplest form is new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looks like another thing broken in 1.6 (fixed in 1.6?)

anyway, it used to work that way
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not using my 1.4.2_10 SDK.

When compiled and run from my Java 6 SDK, I get a default icon.
When compiled and run from my Java 1.4 SDK, I get a default icon.

Different icon, but still some icon, not nothing.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the 1.4 should work like this

frame.setIconImage(new ImageIcon("DoesNotExist.gif").getImage());
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
edit Sorry, Rob already said that.
 
sanket karkare
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all for the quick response, problem solved
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!