Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8365379

SU3.applyInsets may produce wrong results

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8, 11, 17, 21, 24, 26
    • client-libs
    • None

      SwingUtilities3.applyInsets [1] has the following formula:

              if (insets != null) {
                  rect.x += insets.left;
                  rect.y += insets.top;
                  rect.width -= (insets.right + rect.x);
                  rect.height -= (insets.bottom + rect.y);
              }

      This formula produces correct results if and only if rect.x and rect.y are zero.

      This is a pre-existing issue from BasicMenuItemUI [2].

      The issue was found during code review for JDK-8348760 [3].


      [1] https://github.com/openjdk/jdk/blob/19a76a45e9c8616414830c865801660bc6761e92/src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java#L152-L159
      [2] https://github.com/openjdk/jdk/blob/11aadc9d98d364b91114c028c7e2eff8de2f2bf0/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java#L782-L789
      [3] https://github.com/openjdk/jdk/pull/23324#discussion_r2168852213

            psadhukhan Prasanta Sadhukhan
            aivanov Alexey Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: