java禁止放大,对于Java 9应用程序,如何在Windows上禁用缩放UI?

在Java 9中,JavaFX应用会根据显示器的缩放比例自动调整大小。若要在Windows 10上通过命令行参数临时禁用这种缩放,可以使用`-Dprism.allowhidpi=false`。对于Swing应用,相应的选项是`-Dsun.java2d.uiScale=1.0`。然而,目前没有官方文档详细说明这两个选项。
摘要由CSDN通过智能技术生成

There was no proper HiDPI support in Java 8.

In Java 9, JavaFx applications correctly scale to the monitor they are in. For example, if my monitor is set to scale at 150%, the Java application is scaled to 150%.

However, for testing purposes, I need to be able to disable scaling by using java.exe flags, in Windows 10. How can I achieve this?

Also, maybe I can disable (and re-enable) this programmatically within the application itself?

解决方案

I found this obscure option in a substance bug report. This fixes the issue for Swing applications.

-Dsun.java2d.uiScale=1.0

If you're using JavaFX you'll need

-Dprism.allowhidpi=false

Unfortunately I cannot find official documentation for either of these options

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值