java - 应用程序图标不清晰

标签 java icons taskbar

您好,我正在用 Java 制作一个应用程序,但任务栏中的图标又模糊又大,与 Android studio、Netbeans、Chrome 等其他应用程序不同。我正在使用 Adob​​e Illustrator 制作尺寸为 96x96 px 的图标。有什么想法吗?

最佳答案

很可能您使用 Window.setIconImage(Image image) 设置窗口的图标方法。

注意还有另一种方法:Window.SetIconImages(List icons) 。由于不同的平台以不同的尺寸显示应用程序图标(并且调整大小算法通常很糟糕),因此您应该使用它来提供不同尺寸的图标,并且将使用最适合所需尺寸的尺寸。

引自javadoc :

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.

示例:

List<Image> icons = new ArrayList<Image>();
icons.add(new ImageIcon("icon16x16.png").getImage());
icons.add(new ImageIcon("icon32x32.png").getImage());
icons.add(new ImageIcon("icon48x48.png").getImage());
icons.add(new ImageIcon("icon64x64.png").getImage());
window.setIconImages(icons);

关于java - 应用程序图标不清晰,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28068457/

相关文章:

java - 打开模式对话框时从任务栏关闭应用程序

java - ImageView vector 资源在 Nougat 上工作但在 Oreo 上崩溃

android - 使用 Android 将启动器和 Activity 图标分开

java - 在 <dependencyManagement> 部分声明依赖,即使依赖没有在任何地方使用?

java - Android ActionBar - 项目图标不断变化?

html - 使用矢量图标图像中的图标

VB.net 无边框窗体在任务栏上最大化

c# - 工作框架 | C# - 当 WindowStyle = "None"并且窗口最大化时,任务栏不显示

java - 使用 Java 在 XML 中设置嵌入字段的文本

java - Springframework MVC中保存的自增ID