public static CompletionStage < Stage > setStylesheet ( final Stage stage , final String stylesheet ) { LOG . info ( "Setting stylesheet {} for stage {}({})" , stylesheet , stage . toString ( ) , stage . getTitle ( ) ) ; return FxAsync . doOnFxThread ( stage , theStage -> { final Scene stageScene = theStage . getScene ( ) ; stageScene . getStylesheets ( ) . clear ( ) ; stageScene . getStylesheets ( ) . add ( stylesheet ) ; } ) ; }
Boilerplate for setting the stylesheet of a given stage via Java rather than FXML .