Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-2646

Improve border appearances with fractional HiDPI scaling factors (Windows LAF)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 11.0
    • 11.1
    • Windows 10 with HiDPI monitor in fractional scaling mode (e.g. 150%), Java 9 and above

    Description

      On Windows 10 systems with HiDPI monitors, it is possible to specify fractional DPI scaling factors, such as 150%. Some of the borders around components visible in the main NetBeans window end up looking ugly on this setting, because of rounding errors that cause a border 1 logical pixels wide to be painted as either 1 or 2 device pixels wide, depending on exactly where on the screen the border is drawn. This can be seen on Windows 10 with a 150% DPI scaling factor, by dragging the split pane between the "Projects" tab and the source code editor back and forth, and observing spurious changes in the surrounding borders. See the attached screenshots (be sure to view at 100% scaling).

      I'll add a pull request to fix this in the most visible places, which is borders used in the NetBeans tab control. There are similar problems in other Swing components, e.g. JTextField, but that would have to be reported as a bug against the JDK's Windows LAF.

      This issue/PR relates only to the Windows LAF. On MacOS, the problem does not appear, since only an integral scaling factor (2x) is used for HiDPI ("retina") screens, which avoids the underlying rounding errors.

      A similar problem may also appear on Linux; if this is the case, feel free to open a new ticket. I did not have a Linux machine to test on, so I prepared this patch for the Windows LAF only.

      Attachments

        1. BordersBeforePatch.png
          197 kB
          Eirik Bakke
        2. BordersAfterPatch.png
          165 kB
          Eirik Bakke

        Issue Links

          Activity

            People

              ebakke Eirik Bakke
              ebakke Eirik Bakke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m