升级Java后,Swing看起来放大了 [英] Swing looks zoomed after upgrading java

查看:159
本文介绍了升级Java后,Swing看起来放大了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行Swing客户端的旧应用程序.很久以前,我从Java 7升级到了8.升级进行得很好.自从我想升级到Java 9、11和现在的13.但是,这是我遇到的问题.

I have a old application running a Swing client. I upgraded from Java 7 to 8 a long time ago. The upgrade went fine. Ever since I have wanted to upgrade to Java 9, then 11 and now 13. However this is where I meet problems.

UI看起来不错,并且与Java 8一致,但是由于某些原因,任何较新的Java版本都会以某种方式更改字体大小和组件.我没有要显示的图片,因为出于安全原因,该应用程序是在没有Internet访问的网络上维护的.客户看起来大多数事情都乘以2.0左右.它显示为缩放状态,或者可能是您在考虑通用设计的情况下创建的.甚至由于某些原因,初始屏幕的尺寸也增加了一倍,这就是图像.有一些例外.窗口中的标题文本是相同的.此外,按钮和标签上的文字似乎是相等的.文本字段/编辑器中的图标,图像(初始)和文本要大得多.

The UI looks fine and as intended with Java 8, but any newer Java version will somehow change the font sizes and maybe components for some reason. I do not have any pictures to show because the application is maintained on a network without internet access because of security reasons. The client looks like most thing is multiplied with a factor of 2.0 or something. It appears as zoomed or maybe something you would create with universal design in mind. Even the splash screen is doubled in size for some reason and that is an image. There are some exeptions. The title text in the windows is the same. Also text on buttons and lables seems to be equal. Icons, images (splash) and text inside textfields/editors is much larger.

我已经尝试寻找解决方案很长时间了,但是什么也没找到.我希望其他人遇到了这个问题,或者至少知道可能是什么问题.

I have tried to find a solution for a long time but have not found anything. I am hoping someone else have experienced this problem or at least know what the problem could be.

推荐答案

Holgers对操作系统扩展的评论是问题所在.我有一个4K屏幕,在OS中设置了150%的缩放比例.将其恢复为100%可使Java Swing客户端与运行Java 8时的外观相同.

Holgers comment about OS scaling was the issue. I have a 4K screen with 150% scaling set in the OS. Putting it back to 100% made the Java Swing Client look the same as when running Java 8.

要覆盖,请添加-Dsun.java2d.uiScale=1

https://superuser.com/questions/988379/how-do-i-run-java-apps-upscaled-on-high-dpi-display

这篇关于升级Java后,Swing看起来放大了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆