Scaling为Swing应用程序

Scaling为Swing应用程序

本文介绍了有没有办法禁用Mac OS Retina Scaling为Swing应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个相当复杂的应用程序需要尽可能多的屏幕空间,自然视网膜显示Mac Books非常适合这个目的。

We have a rather complex application that needs as much screen real-estate as it can get, naturally the retina display Mac Books are excellent for this purpose.

然而,似乎在Swing中,这些设备使用的是点而不是像素。它们允许我将图标更改为更高分辨率的版本,如上所述。但由于我们做了很多复杂的图形和组件覆盖,我想只使用真实像素。要清楚,我不想修复模糊的图像或图标(在我的情况下不实用)只是为了禁用像素加倍。

However, it seems that in Swing those devices use points rather than pixels. They allow me to change the icons to higher resolution versions as discussed here. But since we do a lot of complex graphics and components overlays I want to just use "real pixels". To be clear I am not interested in fixing blurry images or icons (not practical in my case) just to disable the pixel doubling.

有趣(虽然很笨拙)的选项问题。

There is this interesting (albeit hacky) option I found thru this question.

推荐答案

据我所知,从JDK 1.8开始这是不可能的。唯一的解决方法是检测视网膜并在绘图时使用比例仿射变换。
然而,检测视网膜似乎是一个问题,因为似乎可用的唯一选项不在每个监视器的情况下,这可能不是一个好的解决方案:

To my knowledge this is not possible as of JDK 1.8. The only workaround is to detect retina and use the scale affine transform when drawing.However, detecting retina seems to be a problem since the only option that seems to be available isn't on a per monitor case which is probably not a good solution:How can I detect whether a Mac has a Retina display from Java?

这篇关于有没有办法禁用Mac OS Retina Scaling为Swing应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 01:01