gpt4 book ai didi

java - JFrame 的 setIconImages() 方法使用哪些图标大小?

转载 作者:太空狗 更新时间:2023-10-29 22:43:32 25 4
gpt4 key购买 nike

有谁知道 jFrame 的 setIconImages() (复数)方​​法使用哪种图标大小,以便我的应用程序图标在所有平台和所有上下文中都能很好地显示(例如,窗口图标、任务栏图标、alt-tab 图标等)?

我找到了一个使用 16 像素 x 16 像素和 32 像素 x 32 像素图像的示例,但我需要再大一些吗?

为了测试,我还尝试将 64px 和 128px 版本添加到传递给 setIconImages() 的列表中,但这些似乎没有在我的 Windows 7 机器上使用。但是,我无法在其他机器上轻松测试,所以想知道是否有人知道我应该包括哪些尺寸?

最佳答案

根据 API,运行时从提供的列表中选择最合适的大小来使用。我会供应 16x16 , 32x32 , 64x64128x128让 JVM 在运行时决定。

public void setIconImages(List<? extendsImage> icons)

Sets the sequence of images to be displayed as the icon for this window. Subsequent calls to getIconImages will always return a copy of the icons list.

Depending on the platform capabilities one or several images of different dimensions will be used as the window's icon.

The icons list is scanned for the images of most appropriate dimensions from the beginning. If the list contains several images of the same size, the first will be used.

Ownerless windows with no icon specified use platfrom-default icon. The icon of an owned window may be inherited from the owner unless explicitly overridden. Setting the icon to null or empty list restores the default behavior.

Note : Native windowing systems may use different images of differing dimensions to represent a window, depending on the context (e.g. window decoration, window list, taskbar, etc.). They could also use just a single image for all contexts or no image at all.

Parameters:

     icons - the list of icon images to be displayed.

Since:

     1.6

See Also:

     getIconImages(), setIconImage(Image)

关于java - JFrame 的 setIconImages() 方法使用哪些图标大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15247653/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com