1

I would like to redraw my scene as per code below every 5minutes or so, not sure how to do this. bear in mind that when i call to draw image_pane() it goes through a complicated procedure and calculations. so when I want to redraw my scene it has to call this function again..

public void start(Stage stage) {

        Pane root = new Pane();
        Scene scene = new Scene(root, 1280, 1024);
        scene.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm());
        stage.setScene(scene);

        GridPane Mainpane =   Main_pane();
        GridPane image_pane =   image_pane();
        Mainpane.add(image_pane, 2, 4,9,8);  
        scene.setRoot(Mainpane);
        stage.show();

    }

Update:

public GridPane image_pane() {

    Subpane = new GridPane();        
    String image = JavaFXApplication3.class.getResource("/Images/mussalah_old.png").toExternalForm();
    Subpane.setStyle("-fx-background-image: url('" + image + "'); -fx-background-image-repeat: no-repeat;");        

    Subpane.setGridLinesVisible(true);


    for(i=0; i<=total_donnation; i++)
    {

        File blink_file = new File("blink.png");
        Image blink_image1 = new Image(blink_file.toURI().toString());
        ImageView blink_image = new ImageView(blink_image1);
        blink_image.setFitWidth(image_Width);
        blink_image.setPreserveRatio(true);

        HBox hBox_outter = new HBox();
        String style_outter = "-fx-border-color: white;" + "-fx-border-width: 0;";
        hBox_outter.setStyle(style_outter);
        hBox_outter.getChildren().add(image_tile1);
        HBox hBox_outter_last = new HBox();
        hBox_outter_last.setStyle(style_outter);
        hBox_outter_last.getChildren().add(blink_image);

        FadeTransition ft1 = new FadeTransition(Duration.millis(500), hBox_outter_last);
        ft1.setFromValue(1.0);
        ft1.setToValue(0.3);
        ft1.setCycleCount(Animation.INDEFINITE);
        ft1.setAutoReverse(true);

        ft1.play();

        grid_pane1.add(hBox_outter, current_column_pane1,current_row_pane1);       
        current_row_pane1 = current_row_pane1+1;
        if (current_row_pane1 == max_rows_pane1 )
        {
            current_column_pane1 = current_column_pane1+1;
            current_row_pane1 = 0;
        }
        if (i == max_donnation_pane1 ){ System.out.println("Pane 1 full"); break;}
        if (i == total_donnation)
        {
            if (i != max_donnation_pane1)
            {
                grid_pane1.add(hBox_outter_last, current_column_pane1,current_row_pane1);
            }
        }
    }


    Subpane.add(grid_pane1,3,9,13,14);
    Subpane.setId("prayertime_pane");



    return Subpane;
}
Ossama
  • 2,401
  • 7
  • 46
  • 83
  • I do not have labels to update but would like to redraw my nodes and imageviews – Ossama Jun 29 '14 at 06:49
  • I have now updated my code to show what is happening and why using the example/solution you provided does not possibly help, – Ossama Jun 29 '14 at 06:54

0 Answers0