Creating Usable Toolbar for High Resolution Screen

眉间皱痕 提交于 2020-01-17 08:55:07

问题


High resolution screens are old news, but for some reason we (and the Eclipse guys) ignored them until now. Well, we can't any longer.

What we want to do is create Eclipse applications that work for "normal" displays, but for high resolution ones, too. Right now the icons are way to small to see or click.

This bug links to this (rather sparse) documentation states we only need to use a new constructor for Image. Okay, so we need to create our own implementation of ImageDataProvider.

While that might work for the images we created ourselves, it does not work for the main tool bar icons.

So let's say we'll start a completely new application from scratch: how would we set up everything to make the toolbar work with the new API and so with all kinds of screens?

(There is a similar question, but it's from the perspective of an Eclipse user, while this question is from the perspective of a developer of an Eclipse application.)


回答1:


When HiDPI mode scaling is in use anything using ImageDescriptor.createFromURL to load images will look for a image with @2x or @1.5x appended to the name depending on the current scaling (so, for example, remove.png and remove@2x.png). This is used to create an ImageDataProvider.

Eclipse will use this for the tool bar images and many other things.



来源:https://stackoverflow.com/questions/43626566/creating-usable-toolbar-for-high-resolution-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!