开发者

How to change the image in the upper left corner in a java program [duplicate]

开发者 https://www.devze.com 2023-01-25 06:03 出处:网络
This question already has answers here: How to set Icon to JFrame (12 answers) 开发者_StackOverflow中文版
This question already has answers here: How to set Icon to JFrame (12 answers) 开发者_StackOverflow中文版 Closed 6 years ago.

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号