1

I want to know that how to change the image in the upper left corner in a java program and in the taskbar. See the screenshot to know what i am talking about- http://www.ougfiles.com/dl/303275944/Untitled.jpg

qasimzee
  • 640
  • 1
  • 12
  • 30
Vipul
  • 111
  • 4
  • 13

3 Answers3

2

I think you're looking for Window.setIconImage, where the "window" will probably be a JFrame if this is a Swing app.

Note that there's also Window.setIconImages which allows you to set multiple images, so that it can pick up different resolutions for different situations (e.g. a bigger icon in the Windows task bar than in the frame itself.)

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
1

Use setIconImage() or setIconImages(). The latter lets you specify a list of icons in different resolutions; the most suitable one will be used in each case (desktop, taskbar, title bar of the frame, etc.)

See also the this section in the Java tutorial.

Grodriguez
  • 21,501
  • 10
  • 63
  • 107
  • I tried this earlier but its not happening for me – Vipul Nov 12 '10 at 07:08
  • @Vipul: I suggest to try one of the examples from the Tutorial I linked. Otherwise you can try to reduce your code to a short, self-contained example (http://sscce.org) and add it to your question so that we can have a look. – Grodriguez Nov 12 '10 at 07:23
  • thanks got it to work after invoking the setdecoratedannfeel method and using the object of the frame :)) – Vipul Nov 12 '10 at 07:35
  • Then you might consider to upvote and/or accept the answer :) – Grodriguez Nov 12 '10 at 07:43
0

Quick Google searched revealed a setIconImage for your Frame frame.setIconImage() (oracle.com)

rcapote
  • 1,034
  • 7
  • 19