-
Notifications
You must be signed in to change notification settings - Fork 24
Description
It would be beneficial to have a splash screen displayed while the KafkaEsque application is loading. This would improve the user experience by providing visual feedback that the application is starting up, especially during longer load times.
Proposed Solution
Implement a splash screen that appears immediately when the application is launched and remains visible until the main application window is fully loaded and ready for interaction. The splash screen should include a progress indicator to show that the application is actively loading.
Example Implementation
A possible implementation could involve creating a StackPane with a ProgressIndicator and setting it as the scene of a new Stage that is shown at the start of the Application#start method. The splash screen can be styled with a background color and text color to match the application's theme.
Benefits
- Provides immediate visual feedback to users that the application is starting.
- Enhances the overall user experience by reducing perceived load times.
- Makes the application appear more professional and polished.
Additional Context
Here is an example of how the splash screen could be implemented in the Main class:
@Override
public void start(Stage primaryStage) throws Exception {
StackPane splashLayout = new StackPane();
ProgressIndicator progressIndicator = new ProgressIndicator();
splashLayout.getChildren().add(progressIndicator);
splashLayout.setStyle("-fx-background-color: #282c34; -fx-text-fill: white;");
Scene splashScene = new Scene(splashLayout, 400, 300, Color.TRANSPARENT);
Stage splashStage = new Stage(StageStyle.UNDECORATED);
splashStage.setScene(splashScene);
splashStage.show();
// Load the main application
Injector injector = Guice.createInjector(new GuiceEsqueModule());
FXMLLoader loader = injector.getInstance(FXMLLoader.class);
loader.setLocation(getClass().getResource("/fxml/mainScene.fxml"));
Parent root = loader.load();
final HostServices hostServices = this.getHostServices();
Controller controller = loader.getController();
controller.setHostServices(hostServices);
controller.setup(primaryStage);
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/icons/kafkaesque.png")));
primaryStage.setTitle("KafkaEsque");
primaryStage.setScene(createStyledScene(root, 1600, 900));
primaryStage.show();
// Close the splash screen
splashStage.close();
}