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

Strange issue with LabeledText width computation

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Garuda Linux x86_64 (Arch Linux)
      Kernel: 6.1.6
      DE: GNOME 43.2
      Azul JDK 17 (Comatibility set to 11)

      A DESCRIPTION OF THE PROBLEM :
      I was trying to implement a custom button from scratch, and I discovered a strange issue when computing the width of the text.
      At first, I thought I was doing something wrong in the computation, but then I saw it happening on the original JavaFX button as well.

      Here comes the strange part. I created a small App and set the buttons text to display their bounds (width and height) through a binding.
      The custom button's width is always wrong. The original button's width is: wrong if I build the binding the same way I do for the other one; correct if I bind the text to custom one
      I've also added a handler to force a layout request on click, after the request the width is being corrected. There's also another thing that I found interesting. If I store the custom button's binding for the text in a variable, even forcing the invalidation with "binding.invalidate()" makes the button compute a correct width

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Steps are described in the MRE's src code for better understanding


      ---------- BEGIN SOURCE ----------
      I can share an MRE project upon contact
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Honestly, the only thing that came to my mind is to run a PauseTransition in the skin after N milliseconds and send a layout request

      FREQUENCY : always


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: