Add: added basic window handling

This commit is contained in:
2025-07-26 12:31:18 +02:00
parent e351cb27d9
commit 4c19ca8cf2
8 changed files with 290 additions and 186 deletions

View File

@@ -1,7 +1,8 @@
module org.winkel.damagecontrol {
requires javafx.controls;
requires javafx.fxml;
requires java.desktop;
requires javafx.graphics;
opens org.winkel.damagecontrol to javafx.fxml;
exports org.winkel.damagecontrol;
}

View File

@@ -5,8 +5,13 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import java.io.IOException;
import java.lang.ModuleLayer.Controller;
/**
* JavaFX App
@@ -17,19 +22,26 @@ public class App extends Application {
@Override
public void start(Stage stage) throws IOException {
scene = new Scene(loadFXML("main"), 640, 480);
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource("main.fxml"));
Parent root = fxmlLoader.load();
MainController controller = fxmlLoader.getController();
controller.setStage(stage);
scene = new Scene(root, 1280 , 800);
stage.initStyle(StageStyle.UNDECORATED); // Removes OS title bar
stage.setMaximized(true);
stage.setScene(scene);
stage.show();
}
static void setRoot(String fxml) throws IOException {
scene.setRoot(loadFXML(fxml));
}
private static Parent loadFXML(String fxml) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
return fxmlLoader.load();
}
public static void main(String[] args) {
launch();

View File

@@ -2,13 +2,38 @@ package org.winkel.damagecontrol;
import java.io.IOException;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import javafx.event.ActionEvent;
public class MainController {
@FXML
private Button closeApp;
@FXML
private Label appMode;
@FXML
private Label clientStatus;
private Stage stage;
public void setStage(Stage stage) {
this.stage = stage;
}
@FXML
public void closeApplication() {
System.exit(0);
}
public void minimizeApplication() {
stage.setIconified(true);
}
public void maximizeApplication()
{
stage.setMaximized(!stage.isMaximized());
}
}

View File

@@ -33,23 +33,28 @@
-->
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.SeparatorMenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.paint.Color?>
<?import javafx.scene.text.Font?>
<VBox prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/24.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.winkel.damagecontrol.MainController">
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" xmlns="http://javafx.com/javafx/24.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.winkel.damagecontrol.MainController">
<children>
<MenuBar VBox.vgrow="NEVER">
<AnchorPane maxHeight="25.0" prefHeight="25.0">
<children>
<HBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<AnchorPane>
<children>
<MenuBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
@@ -64,7 +69,7 @@
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Preferences…" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Quit" />
<MenuItem mnemonicParsing="false" onAction="#closeApplication" text="Quit" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
@@ -88,37 +93,62 @@
</Menu>
</menus>
</MenuBar>
<SplitPane dividerPositions="0.2505567928730512, 0.7505567928730512" focusTraversable="true" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
</children>
</AnchorPane>
</children>
</HBox>
<AnchorPane AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Button mnemonicParsing="false" onAction="#maximizeApplication" text="🗖" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="45.0" AnchorPane.topAnchor="0.0" />
<Button fx:id="closeButton" mnemonicParsing="false" onAction="#closeApplication" text="x" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<Button mnemonicParsing="false" onAction="#minimizeApplication" text="_" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="23.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</children>
</AnchorPane>
<AnchorPane VBox.vgrow="ALWAYS">
<children>
<HBox layoutX="604.0" layoutY="14.0" prefHeight="648.0" prefWidth="1098.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<AnchorPane>
<children>
<Pane prefHeight="648.0" prefWidth="705.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Label text="Label" />
</children>
</Pane>
</children>
</AnchorPane>
<AnchorPane prefHeight="648.0" prefWidth="558.0" HBox.hgrow="ALWAYS">
<children>
<SplitPane dividerPositions="0.28527131782945736, 0.6232558139534884" orientation="VERTICAL" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="212.0" prefWidth="548.0">
<children>
<Label alignment="CENTER" layoutX="14.0" layoutY="14.0" minWidth="60.0" prefWidth="-1.0" style="&#10;" text="Master" textAlignment="CENTER" wrapText="false">
<font>
<Font size="18.0" fx:id="x1" />
</font>
<textFill>
<Color red="0.624" green="0.624" blue="0.624" fx:id="x2" />
</textFill>
</Label>
<Label layoutX="14.0" layoutY="6.0" text="Top 3 Schiff" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="10.0" />
</children>
</AnchorPane>
<ScrollPane prefHeight="-1.0" prefWidth="-1.0">
<content>
<AnchorPane id="Content" minHeight="-1.0" minWidth="-1.0" prefHeight="545.0" prefWidth="430.0">
<AnchorPane prefHeight="279.0" prefWidth="310.0">
<children>
<Label alignment="CENTER" font="$x1" layoutX="14.0" layoutY="14.0" style="&#10;" text="View" textAlignment="CENTER" textFill="$x2" wrapText="false" />
<Label layoutX="14.0" layoutY="6.0" text="ETBOL's" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="10.0" />
</children>
</AnchorPane>
</content>
</ScrollPane>
<AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="154.0" prefWidth="161.0">
<children>
<Label alignment="CENTER" font="$x1" layoutX="14.0" layoutY="14.0" style="&#10;" text="Details" textAlignment="CENTER" textFill="$x2" wrapText="false" />
<Label layoutX="8.0" layoutY="6.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" text="Command Aim" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="10.0" />
</children>
</AnchorPane>
</items>
</SplitPane>
<HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0" VBox.vgrow="NEVER">
</children>
</AnchorPane>
</children>
</HBox>
</children>
</AnchorPane>
<AnchorPane maxHeight="24.0" prefHeight="24.0">
<children>
<HBox id="HBox" alignment="CENTER_LEFT" maxHeight="24.0" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="24.0" spacing="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Label maxHeight="1.7976931348623157E308" maxWidth="-1.0" text="Mode:" HBox.hgrow="ALWAYS">
<font>
@@ -128,12 +158,15 @@
<Pane prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="ALWAYS">
<children>
<Label fx:id="appMode" text="none" />
</children></Pane>
<Label font="$x3" maxWidth="-1.0" text="Right status" HBox.hgrow="NEVER" />
</children>
</Pane>
<Label fx:id="clientStatus" font="$x3" maxWidth="-1.0" text="Right status" HBox.hgrow="NEVER" />
</children>
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
</HBox>
</children>
</AnchorPane>
</children>
</VBox>

Binary file not shown.

View File

@@ -33,23 +33,28 @@
-->
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.SeparatorMenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.paint.Color?>
<?import javafx.scene.text.Font?>
<VBox prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/24.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.winkel.damagecontrol.MainController">
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1280.0" xmlns="http://javafx.com/javafx/24.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.winkel.damagecontrol.MainController">
<children>
<MenuBar VBox.vgrow="NEVER">
<AnchorPane maxHeight="25.0" prefHeight="25.0">
<children>
<HBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<AnchorPane>
<children>
<MenuBar AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
@@ -64,7 +69,7 @@
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Preferences…" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Quit" />
<MenuItem mnemonicParsing="false" onAction="#closeApplication" text="Quit" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
@@ -88,37 +93,62 @@
</Menu>
</menus>
</MenuBar>
<SplitPane dividerPositions="0.2505567928730512, 0.7505567928730512" focusTraversable="true" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
</children>
</AnchorPane>
</children>
</HBox>
<AnchorPane AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Button mnemonicParsing="false" onAction="#maximizeApplication" text="🗖" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="45.0" AnchorPane.topAnchor="0.0" />
<Button fx:id="closeButton" mnemonicParsing="false" onAction="#closeApplication" text="x" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<Button mnemonicParsing="false" onAction="#minimizeApplication" text="_" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="23.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</children>
</AnchorPane>
<AnchorPane VBox.vgrow="ALWAYS">
<children>
<HBox layoutX="604.0" layoutY="14.0" prefHeight="648.0" prefWidth="1098.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<AnchorPane>
<children>
<Pane prefHeight="648.0" prefWidth="705.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Label text="Label" />
</children>
</Pane>
</children>
</AnchorPane>
<AnchorPane prefHeight="648.0" prefWidth="558.0" HBox.hgrow="ALWAYS">
<children>
<SplitPane dividerPositions="0.28527131782945736, 0.6232558139534884" orientation="VERTICAL" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="212.0" prefWidth="548.0">
<children>
<Label alignment="CENTER" layoutX="14.0" layoutY="14.0" minWidth="60.0" prefWidth="-1.0" style="&#10;" text="Master" textAlignment="CENTER" wrapText="false">
<font>
<Font size="18.0" fx:id="x1" />
</font>
<textFill>
<Color red="0.624" green="0.624" blue="0.624" fx:id="x2" />
</textFill>
</Label>
<Label layoutX="14.0" layoutY="6.0" text="Top 3 Schiff" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="10.0" />
</children>
</AnchorPane>
<ScrollPane prefHeight="-1.0" prefWidth="-1.0">
<content>
<AnchorPane id="Content" minHeight="-1.0" minWidth="-1.0" prefHeight="545.0" prefWidth="430.0">
<AnchorPane prefHeight="279.0" prefWidth="310.0">
<children>
<Label alignment="CENTER" font="$x1" layoutX="14.0" layoutY="14.0" style="&#10;" text="View" textAlignment="CENTER" textFill="$x2" wrapText="false" />
<Label layoutX="14.0" layoutY="6.0" text="ETBOL's" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="10.0" />
</children>
</AnchorPane>
</content>
</ScrollPane>
<AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="154.0" prefWidth="161.0">
<children>
<Label alignment="CENTER" font="$x1" layoutX="14.0" layoutY="14.0" style="&#10;" text="Details" textAlignment="CENTER" textFill="$x2" wrapText="false" />
<Label layoutX="8.0" layoutY="6.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" text="Command Aim" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="10.0" />
</children>
</AnchorPane>
</items>
</SplitPane>
<HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0" VBox.vgrow="NEVER">
</children>
</AnchorPane>
</children>
</HBox>
</children>
</AnchorPane>
<AnchorPane maxHeight="24.0" prefHeight="24.0">
<children>
<HBox id="HBox" alignment="CENTER_LEFT" maxHeight="24.0" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="24.0" spacing="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Label maxHeight="1.7976931348623157E308" maxWidth="-1.0" text="Mode:" HBox.hgrow="ALWAYS">
<font>
@@ -128,12 +158,15 @@
<Pane prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="ALWAYS">
<children>
<Label fx:id="appMode" text="none" />
</children></Pane>
<Label font="$x3" maxWidth="-1.0" text="Right status" HBox.hgrow="NEVER" />
</children>
</Pane>
<Label fx:id="clientStatus" font="$x3" maxWidth="-1.0" text="Right status" HBox.hgrow="NEVER" />
</children>
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
</HBox>
</children>
</AnchorPane>
</children>
</VBox>