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

Possible bug when calculating the close button position in TabHeaderSkin

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      Please take a look at this lines
      https://github.com/openjdk/jfx/blob/04c5e40cc116cb42150572959b53d1e465700e0e/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java#L1343
      https://github.com/openjdk/jfx/blob/04c5e40cc116cb42150572959b53d1e465700e0e/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java#L1394

      final double w = getWidth() - (paddingLeft + paddingRight);
      ...
      double closeBtnStartX = (maxWidth < Double.MAX_VALUE ? Math.min(w, maxWidth) : w) - paddingRight - closeBtnWidth;

      As you can see, the position is calculated by subtracting paddingRight, but the variable `w` has already been reduced by paddingRight. Maybe it is a bug.


        1. Screenshot 2025-07-15 at 13.14.26.png
          142 kB
          Andy Goryachev
        2. TabPane_Width_8362255.java
          1.0 kB
          Andy Goryachev

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: