How to change the image in the upper left corner in a java program [duplicate]
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
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.)
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.
Quick Google searched revealed a setIconImage for your Frame frame.setIconImage() (oracle.com)
精彩评论