【发布时间】:2011-09-09 09:59:13
【问题描述】:
我编写了一个 SWT Java 应用程序,并希望将其配置为在 OSX 扩展坞中使用高质量图标。这是我当前的代码:
// Prepare window
final Shell window = new Shell();
// Load icons
Display display = window.getDisplay();
ClassLoader loader = InTraceStandaloneUI.class.getClassLoader();
InputStream is16 = loader.getResourceAsStream(
"org/intrace/icons/intrace16.gif");
Image icon16 = new Image(display, is16);
is16.close();
InputStream is32 = loader.getResourceAsStream(
"org/intrace/icons/intrace32.gif");
Image icon32 = new Image(display, is32);
is32.close();
window.setImages(new Image[] {icon16, icon32});
这适用于加载在 Windows 上看起来不错的 16x16 和 32x32 徽标,但 OSX 使用的徽标看起来仍然像素化。我是否只需要指定分辨率更高的第三个版本,还是应该使用不同的图像格式或 API?
【问题讨论】: