Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect the windows font size(100%, 125%, 150%) in java

I am using an swt dialog in which the controls get cut off from the screen if I increase the font size(Control Panel-> Display) from smaller(100%) to large(150%) This can be solved using

  1. Scrollable composite or
  2. To resize the controls or font size if the windows size has been changed to larger.

For point 2, I am unable to get the current Windows size. If I get that, the problem can be solved as the scrollable composite isn't suitable for the smaller size.

like image 291
V_Java Avatar asked Oct 16 '25 11:10

V_Java


1 Answers

I did it in the following way:

Display.getCurrent().getDPI().x

Here, based on the return value(96, 120 or 144) it can be determined if the size is 100%, 125% or 150% respectively

like image 81
V_Java Avatar answered Oct 18 '25 03:10

V_Java



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!