Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splash Screen During Application Load #79

Open
dheid opened this issue Jan 17, 2025 · 0 comments
Open

Splash Screen During Application Load #79

dheid opened this issue Jan 17, 2025 · 0 comments

Comments

@dheid
Copy link

dheid commented Jan 17, 2025

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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant