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

Spinner: throws IllegalArgumentException when replacing skin

XMLWordPrintable

    • b11

      following test snippet fails with IllegalStateException:

          @Test
          public void testSpinnerSkin() {
              Spinner<?> spinner = new Spinner<>();
              spinner.setSkin(new SpinnerSkin<>(spinner));
              spinner.setSkin(new SpinnerSkin<>(spinner));
          }
          
      Exception:

      java.lang.IllegalArgumentException: Children: duplicate children added: parent = Spinner@2b40ff9c[styleClass=spinner]
      at javafx.graphics/javafx.scene.Parent$3.onProposedChange(Parent.java:560)
      at javafx.base/com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:206)
      at javafx.controls/javafx.scene.control.skin.SpinnerSkin.<init>(SpinnerSkin.java:112)
      at javafx.controls/test.javafx.scene.control.skin.SkinIssuesTest.testSpinnerSkin(SkinIssuesTest.java:92)

      turned up working on JDK-8244531

      don't quite understand why it is a problem here but not in ComboXX (which may or may not have an editor) - they also have editors, any ideas?

      NOTE: the fix requires both ListenerHelper JDK-8294809 and Skin.install() JDK-8290844 changes.

            angorya Andy Goryachev
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: