...
......
........
private void init(Stage primaryStage) { Group root = new Group(); primaryStage.setScene(new Scene(root)); //create a button for initializing our new stage Button button = new Button("Create a Stage"); button.setStyle("-fx-font-size: 24;"); button.setDefaultButton(true); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { final Stage stage = new Stage(); //create root node of scene, i.e. group Group rootGroup = new Group(); //create scene with set width, height and color Scene scene = new Scene(rootGroup, 200, 200, Color.WHITESMOKE); //set scene to stage stage.setScene(scene); //center stage on screen stage.centerOnScreen(); //show the stage stage.show(); //add some node to scene Text text = new Text(20, 110, "JavaFX"); text.setFill(Color.DODGERBLUE); text.setEffect(new Lighting()); text.setFont(Font.font(Font.getDefault().getFamily(), 50)); //add text to the main root group rootGroup.getChildren().add(text); } }); root.getChildren().add(button); } @Override public void start(Stage primaryStage) throws Exception { init(primaryStage); primaryStage.show(); }............... 
Nenhum comentário:
Postar um comentário