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

Applying "-fx-content-display" style to a CheckBox or RadioButton with Graphic node produces "duplicate children added" exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • 8
    • 8
    • javafx

      Applying "-fx-content-display" style to a CheckBox or RadioButton with Graphic node produces "duplicate children added" exception:

      Exception in Application start method
      Exception in thread "main" java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:491)
      at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:778)
      Caused by: java.lang.RuntimeException: Exception in Application start method
      at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:867)
      at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
      at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
      at java.lang.Thread.run(Thread.java:724)
      Caused by: java.lang.IllegalArgumentException: Children: duplicate children added: parent = CheckBox@273dd385[styleClass=check-box]'Ololo'
      at javafx.scene.Parent$2.onProposedChange(Parent.java:444)
      at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:199)
      at com.sun.javafx.scene.control.skin.CheckBoxSkin.updateChildren(CheckBoxSkin.java:59)
      at com.sun.javafx.scene.control.skin.LabeledSkinBase.handleControlPropertyChanged(LabeledSkinBase.java:186)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$2.call(BehaviorSkinBase.java:179)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$2.call(BehaviorSkinBase.java:177)
      at com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler$1.changed(MultiplePropertyChangeListenerHandler.java:55)
      at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:88)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:176)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
      at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105)
      at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
      at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:145)
      at javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:82)
      at javafx.css.StyleableObjectProperty.applyStyle(StyleableObjectProperty.java:68)
      at javafx.scene.CssStyleHelper.resetToInitialValues(CssStyleHelper.java:297)
      at javafx.scene.CssStyleHelper.createStyleHelper(CssStyleHelper.java:179)
      at javafx.scene.Node.impl_processCSS(Node.java:8646)
      at javafx.scene.Parent.impl_processCSS(Parent.java:1192)
      at javafx.scene.control.Control.impl_processCSS(Control.java:870)
      at javafx.scene.Parent.impl_processCSS(Parent.java:1204)
      at javafx.scene.Node.processCSS(Node.java:8575)
      at javafx.scene.Scene.doCSSPass(Scene.java:538)
      at javafx.scene.Scene.preferredSize(Scene.java:1503)
      at javafx.scene.Scene.impl_preferredSize(Scene.java:1570)
      at javafx.stage.Window$9.invalidated(Window.java:733)
      at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109)
      at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:143)
      at javafx.stage.Window.setShowing(Window.java:799)
      at javafx.stage.Window.show(Window.java:814)
      at javafx.stage.Stage.show(Stage.java:243)
      at javafxapplication1.JavaFXApplication1.start(JavaFXApplication1.java:39)
      at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:810)
      at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:278)
      at com.sun.javafx.application.PlatformImpl$5$1.run(PlatformImpl.java:244)
      at com.sun.javafx.application.PlatformImpl$5$1.run(PlatformImpl.java:241)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:241)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
      at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:101)
      ... 1 more
      Java Result: 1

      To reproduce, use the following application:
      import javafx.application.Application;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.CheckBox;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;

      public class Main extends Application {

          public static final String style = "-fx-content-display: bottom;";

          @Override
          public void start(Stage stage) throws Exception {
              Rectangle r = new Rectangle(10, 10, Color.BLUEVIOLET);
              CheckBox b = new CheckBox("Ololo");
              b.setGraphic(r);
              System.out.println(style);
              b.setStyle(style);
              Scene s = new Scene(new Group(b));
              s.setFill(Color.DARKORANGE);
              stage.setScene(s);
              stage.setTitle(com.sun.javafx.runtime.VersionInfo.getRuntimeVersion());
              stage.show();
          }
      }

            psomashe Parvathi Somashekar (Inactive)
            ilatyshe Irina Grineva (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: