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

[Skin] Skin reregistration leads to double text typing

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7u45
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
      None

      Description

      I have developed my own subclass of TextField and it uses a skin class which is its own subclass of TextFieldSkin. At some point I register the skin like this

      setSkin(new MyTextFieldSkin())

      This works just fine. However, this line of code is part of a larger method, and in some cases that method may be executed more than once during an execution of my app. This effectively means I instantiate a new MyTextFieldSkin and assigns it to the TextField, replacing the existing MyTextFieldSkin.

      And this is where I have discovered a bug. After setting the skin twice any keyboard input to the TextField is registered twice, so typing the K key adds the characters "kk" to the TextField contents. This is consistent, so if I run this code

      setSkin(new MyTextFieldSkin())
      setSkin(new MyTextFieldSkin())
      setSkin(new MyTextFieldSkin())

      and then type the P key once, I get "ppp" – three P's, one for each skin. I am guessing the setSkin method forgets to unregister the previous skin.

      I do not have the time to build a seperate test app which illustrates the bug, but do not hessitate to ask any questions you might have.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              leifs Leif Samuelsson (Inactive)
              Reporter:
              risaksen Randahl Isaksen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: