Skip to content

Instantly share code, notes, and snippets.

@bekwam
Created February 7, 2017 22:07
Show Gist options
  • Save bekwam/f1a1b5c9d310978ffc01084eb40846a2 to your computer and use it in GitHub Desktop.
Save bekwam/f1a1b5c9d310978ffc01084eb40846a2 to your computer and use it in GitHub Desktop.
A JavaFX App That Takes Up the Whole Screen (Primary)
public class FullScreenApp extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
VBox vbox = new VBox(new Label("Hello, World!"));
vbox.setAlignment(Pos.TOP_CENTER); // 0, auto
Scene scene = new Scene( vbox );
primaryStage.setScene( scene );
primaryStage.setWidth(Screen.getPrimary().getBounds().getWidth());
primaryStage.setHeight(Screen.getPrimary().getBounds().getWidth());
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment