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

UI which loads the localhost page of springboot #40

Open
immarisabel opened this issue Jun 30, 2023 · 2 comments
Open

UI which loads the localhost page of springboot #40

immarisabel opened this issue Jun 30, 2023 · 2 comments
Labels
🙅‍♀️ wontfix This will not be worked on

Comments

@immarisabel
Copy link
Owner

Develop the Spring Boot application: First, you need to create your Spring Boot application that exposes a localhost page. This can be done using Spring MVC or Spring WebFlux, depending on your preference. Ensure that your application is running properly and can be accessed through a web browser by visiting http://localhost:.

Create a Java desktop application: You can use a Java GUI framework like JavaFX or Swing to create your desktop UI application. Both frameworks provide tools and libraries for building desktop applications with user interfaces.

Embed a browser component: To display the localhost page within your desktop UI, you need to embed a browser component that can render HTML content. JavaFX provides the WebView component, while Swing has the JEditorPane component. These components allow you to load and display web pages within your desktop application.

Load the localhost page: Using the browser component, you can load the localhost page from your Spring Boot application. You need to provide the URL of the localhost page (e.g., http://localhost:) to the browser component, and it will render and display the page within your desktop application.

Handle communication between UI and backend: If you need to interact with the Spring Boot application's backend from your desktop UI, you can use various mechanisms like RESTful APIs or WebSocket communication. You can define endpoints in your Spring Boot application to handle requests coming from the desktop UI, and vice versa.

@immarisabel
Copy link
Owner Author

sample:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class DesktopApp extends Application {

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

    @Override
    public void start(Stage primaryStage) {
        // Create a WebView component
        WebView webView = new WebView();

        // Load the localhost page
        webView.getEngine().load("http://localhost:8080"); // Replace with your Spring Boot app's URL

        // Create a Scene with the WebView
        Scene scene = new Scene(webView, 800, 600);

        // Set the Scene on the Stage
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}

@immarisabel immarisabel added the 🔨 enhancement New feature or request label Jul 3, 2023
@immarisabel
Copy link
Owner Author

doing it launching both UI and tomcat app is tooc omplex for now.

@immarisabel immarisabel added 🙅‍♀️ wontfix This will not be worked on and removed 🔨 enhancement New feature or request labels Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙅‍♀️ wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant