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.
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.
- duplicates
-
JDK-8088568 TextField get artifacts, when skin is replaced.
-
- Open
-