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

It's impossible to bind layoutX/layoutY property to something else.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 8
    • 7u6
    • javafx
    • windows 7

      To reproduce run following code. You will get exception.

      public class GroupApp extends Application {

          @Override
          public void start(Stage primaryStage) {

              StackPane root = new StackPane();
              Group g = new Group();
              DoubleProperty d = new SimpleDoubleProperty(0);
              g.layoutXProperty().bind(d);
              root.getChildren().add(g);

              Scene scene = new Scene(root, 500, 500);

              primaryStage.setScene(scene);
              primaryStage.show();
              TimelineBuilder.create().keyFrames(new KeyFrame(Duration.seconds(6), new KeyValue(d, 10))).build().play();
          }
          public static void main(String[] args) {
              launch(args);
          }
      }

      ///exception


      Caused by: java.lang.RuntimeException: A bound value cannot be set.
      at javafx.beans.property.DoublePropertyBase.set(DoublePropertyBase.java:159)
      at javafx.scene.Node.setLayoutX(Node.java:2153)
      at javafx.scene.Node.relocate(Node.java:2257)
      at javafx.scene.layout.Region.position(Region.java:2033)
      at javafx.scene.layout.Region.layoutInArea(Region.java:2014)
      at javafx.scene.layout.Region.layoutInArea(Region.java:1915)
      at javafx.scene.layout.StackPane.layoutChildren(StackPane.java:348)
      at javafx.scene.Parent.layout(Parent.java:1018)
      at javafx.scene.Scene.layoutDirtyRoots(Scene.java:513)
      at javafx.scene.Scene.doLayoutPass(Scene.java:484)
      at javafx.scene.Scene.preferredSize(Scene.java:1455)
      at javafx.scene.Scene.impl_preferredSize(Scene.java:1482)
      at javafx.stage.Window$10.invalidated(Window.java:719)
      at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:127)
      at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:161)
      at javafx.stage.Window.setShowing(Window.java:782)
      at javafx.stage.Window.show(Window.java:797)
      at javafx.stage.Stage.show(Stage.java:229)
      at javafxapplication11.GroupApp.start(GroupApp.java:37)

            msladecek Martin Sládeček
            anazarov Andrey Nazarov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: