sizeToScene : Stage « JavaFX « Java






sizeToScene

 
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene; 
import javafx.scene.text.Text; 
import javafx.stage.Stage; 

public class Main extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group(new Text(25, 25, "Hello World!"))); 

        stage.setTitle("Welcome to JavaFX!"); 
        stage.setScene(scene); 
        stage.sizeToScene(); 
        stage.show(); 
    }

    public static void main(String[] args) {
        Application.launch(args);
    }
}

   
  








Related examples in the same category

1.Show UNDECORATED window
2.Set title for Window
3.Stage as a Dialog
4.TRANSPARENT window
5.Move Stage window to back
6.Moving stage window to front
7.Close stage window
8.Stage close event
9.Full screen stage