mirror of
https://github.com/Vale54321/schafkopf-bot.git
synced 2025-12-16 11:49:33 +01:00
Mono Repo
* moveBackend * added Frontend * added env support for COM port * added frontend into monorepo
This commit is contained in:
committed by
GitHub
parent
fb7ae31a0d
commit
09c38c81dd
50
Backend/src/main/java/org/schafkopf/JavaFxApp.java
Normal file
50
Backend/src/main/java/org/schafkopf/JavaFxApp.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package org.schafkopf;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.web.WebView;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/** Frontend Window. */
|
||||
public class JavaFxApp extends Application {
|
||||
|
||||
private static final String FRONTEND_URL =
|
||||
"http://localhost:8081"; // Replace with your frontend URL
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
// Create a WebView
|
||||
WebView webView = new WebView();
|
||||
|
||||
// Load the frontend URL
|
||||
webView.getEngine().load(FRONTEND_URL);
|
||||
|
||||
// Create a Scene with the WebView
|
||||
Scene scene = new Scene(webView, 800, 600);
|
||||
|
||||
// Set up the Stage
|
||||
primaryStage.setTitle("Schafkopfen");
|
||||
primaryStage.setScene(scene);
|
||||
|
||||
primaryStage.setFullScreenExitHint("");
|
||||
|
||||
// Set the stage to fullscreen
|
||||
primaryStage.setFullScreen(true);
|
||||
|
||||
// Add event handler for the Escape key to toggle fullscreen
|
||||
scene.setOnKeyPressed(
|
||||
event -> {
|
||||
if (event.getCode() == KeyCode.F11) {
|
||||
primaryStage.setFullScreen(!primaryStage.isFullScreen());
|
||||
}
|
||||
});
|
||||
|
||||
// Show the Stage
|
||||
primaryStage.show();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user