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

KeyValue ignored if it only appears in a KeyFrame with 0 duration

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8, 9
    • javafx
    • None

      I discovered a bug, so I wrote the following test case to show the problem. If one makes a node invisible and later changes its visibility to true from a Timeline nothing happens.

      Workaround: You can change the visibility using a KeyEvent mounted EventHandler.

      public class VisibilityTest extends Application {

      @Override
      public void init() throws Exception {
      }

      @Override
      public void start(Stage stage) throws Exception {
      BorderPane root = new BorderPane();
      Scene scene = new Scene(root);
      Circle circle = new Circle(200);
      circle.setFill(Color.RED);
      root.setCenter(circle);
      circle.setVisible(false);

      Timeline timeline = new Timeline(
      new KeyFrame(Duration.ZERO, new KeyValue(circle.visibleProperty(), true))
      );
      timeline.play();

      stage.setScene(scene);
      stage.setTitle("Visibility test");
      stage.setWidth(600);
      stage.setHeight(600);
      stage.show();
      }

      public static void main(String... arguments) {
      launch(VisibilityTest.class, arguments);
      }
      }

            Unassigned Unassigned
            risaksen Randahl Isaksen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: