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
Asked
Active
Viewed 1,483 times
3 Answers
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
-
thanks got it to work after invoking the setdecoratedannfeel method :)) – Vipul Nov 12 '10 at 07:35
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
-
-
@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
-
0
Quick Google searched revealed a setIconImage for your Frame frame.setIconImage() (oracle.com)

rcapote
- 1,034
- 7
- 19