Java / Swing how to deal with different screen DPI and density settings?

前端 未结 3 1964
广开言路
广开言路 2021-02-10 10:35

Hi everyone I\'ve recently come across the problem that now days some monitors have different DPI settings, some monitors are much more dense such as, for example, Apple\'s Reti

3条回答
  •  春和景丽
    2021-02-10 10:52

    First, trust the platform's Look & Feel designers to choose sensible default sizes for text and controls. Then, avoid the temptation to frustrate those defaults. Here are some heuristics:

    • Use layouts; when contemplating absolute positioning, consider a custom layout.

    • Respect the preferred size of components.

    • Avoid non-resizable components.

    • In animation, scale graphics to the size of the enclosing Window.

    • Test across a range of platforms, using emulation as required.

提交回复
热议问题