相同屏幕分辨率下的 Java 布局差异

发布于 2024-11-15 12:11:06 字数 362 浏览 4 评论 0原文

我有两个使用相同分辨率 (1280x1024) 的屏幕,但其中一个的刷新率为 59.9 HZ,另一个的刷新率为 75 HZ。我有一个使用 Java 开发的完整软件(在 OpenSuse 10.0 下运行)。问题在于该软件中的 Jtable 在两个屏幕上的显示方式不同:它们在一个屏幕上完美显示,而在另一个屏幕上,列的宽度不断增加,从而隐藏了一些列。 我能够从两个屏幕获得的另一个区别是当我使用 Toolkit.getDefaultToolkit().getScreenResolution() 时,它在“良好显示”屏幕上为我提供了 93,在“不良显示”屏幕上为我提供了 95。

我的问题是,为什么使用相同分辨率的两个屏幕会以不同的方式显示 GUI 组件?它与屏幕的刷新率或 DPI 是否有关系?

I have two screens that are using the same resolution (1280x1024), but one of them has a refresh rate of 59.9 HZ, and the other one has a refresh rate of 75 HZ. I have a full software that's developed using Java (and running under OpenSuse 10.0). The problem is that the Jtables in this software are being displayed differently on both screens: They're being displayed perfectly on one screen, and on the other screen, the widths of the columns are increasing, which is hiding some of the columns.
The other difference that I was able to get from both screens, is when I used the Toolkit.getDefaultToolkit().getScreenResolution(), which gave me 93 on the "good display" screen and 95 on the "bad display" screen.

My question is, why would two screens that are using the same resolution, display GUI components differently? Does it have to do anything with the refresh rate or with the DPI of the screen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何其悲哀 2024-11-22 12:11:06

检查您可用的字体。逻辑字体名称(serif、sansserif、monospaced、dialog、dialoginput)是根据计算机上可用的字体创建的。

根据 字体 javadoc

通常,每个逻辑字体名称映射到多个物理字体,以便覆盖大范围的字符。

因此,如果可用字体不匹配,Java 可能会替换不同的物理字体字符。这可能会导致您所描述的行为。

Check your available fonts. The logical font names (serif, sansserif, monospaced, dialog, dialoginput) are created from the fonts available on your machine.

Per the Font javadoc:

Typically, each logical font name maps to several physical fonts in order to cover a large range of characters.

So, if the available fonts do not match, Java may be substituting different physical font characters. That can cause the behavior you are describing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文