I need to figure out what the scaling is set to. This answer at Windows scaling gives code in c/c++/c#, but I need it in Java and would much prefer to not have to do JNI. Is there a way to use JNA to get that information?
Asked
Active
Viewed 959 times
1 Answers
4
This appears to do it:
GraphicsConfiguration asdf = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
AffineTransform asfd2 = asdf.getDefaultTransform();
double scaleX = asfd2.getScaleX();
double scaleY = asfd2.getScaleY();
Forgive the bad variable names. And instead of defaults, you may want to account for multiple displays. But that shows how it can be done.
Samuel Philipp
- 9,983
- 12
- 32
- 52
CamHart
- 3,366
- 6
- 29
- 63
-
Thanks a lot. You are a savior. However one thing I would like to point out. In Java 8. Value is always coming as 1.0 Working fine in open jdk 11. – Vaibhav Jain Nov 17 '19 at 11:25