相同屏幕分辨率下的 Java 布局差异
我有两个使用相同分辨率 (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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查您可用的字体。逻辑字体名称(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:
So, if the available fonts do not match, Java may be substituting different physical font characters. That can cause the behavior you are describing.