Вопрос

When using int resolution = Toolkit.getDefaultToolkit().getScreenResolution(); to get my monitor's resolution, the integer resolution returns 96. What does this mean, how could it be used, and, if possible, could I get the resolution in a 4:3, 16:9, etc. format?

Это было полезно?

Решение

getScreenResolution() return dots-per-inch (DPI). If you want the size of the screen, just use getScreenSize().

Here's a quote that gets you the basic idea of DPI vs. pixels:

So, if you have a 600 pixel x 600 pixel image at 300DPI, it will output at 2 inches square. If you change this images DPI to 150, this will mean it will output at 4 inches square. So, as you can see, changing the DPI of an image changes it output size.

You can find rest of the explanation here.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top