package test; import java.util.Date; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.scene.layout.FlowPane; import javafx.stage.Stage; public class TestFX extends Application { @Override public void start(Stage primaryStage) throws Exception { final FlowPane targetPane = new FlowPane(); FlowPane p = new FlowPane(); Button b = new Button("Refresh"); p.getChildren().add(b); b.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { targetPane.getChildren(); targetPane.getChildren().add(new TextField(new Date().toString())); } }); b = new Button("Append"); p.getChildren().add(b); b.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { targetPane.getChildren().add(new TextField(new Date().toString())); } }); Scene s = new Scene(p); primaryStage.setScene(s); primaryStage.show(); Stage stage2 = new Stage(); Scene s2 = new Scene(targetPane); stage2.setScene(s2); stage2.show(); } public static void main(String[] args) { launch(args); } }