Browse Source

resources paths

master
Hendrik Schutter 2 months ago
parent
commit
1bb3acfb9c
  1. 1
      bin/.gitignore
  2. 1
      bin/main/resources/css/application.css
  3. 71
      bin/main/resources/fxml/MainWindow.fxml
  4. 10
      src/main/java/com/Stoppuhr/application/Main.java

1
bin/.gitignore vendored

@ -1 +0,0 @@
/main/

1
bin/main/resources/css/application.css

@ -0,0 +1 @@
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */

71
bin/main/resources/fxml/MainWindow.fxml

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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.SeparatorMenuItem?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="mainAnchorpane" maxHeight="400.0" maxWidth="500.0" minHeight="400.0" minWidth="500.0" prefHeight="400.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="main.java.com.Stoppuhr.application.Main">
<children>
<BorderPane prefHeight="400.0" prefWidth="500.0">
<bottom>
<HBox prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<Button fx:id="startStopButton" maxHeight="30.0" maxWidth="60.0" minHeight="30.0" minWidth="60.0" mnemonicParsing="false" onAction="#startStopButtonAction" prefHeight="30.0" prefWidth="60.0" text="Start">
<font>
<Font name="Cantarell Regular" size="13.0" />
</font>
<HBox.margin>
<Insets left="180.0" top="20.0" />
</HBox.margin>
</Button>
<Button fx:id="resetButton" maxHeight="30.0" maxWidth="60.0" minHeight="30.0" minWidth="60.0" mnemonicParsing="false" onAction="#resetButtonAction" prefHeight="30.0" prefWidth="60.0" text="Reset">
<font>
<Font name="Cantarell Regular" size="13.0" />
</font>
<HBox.margin>
<Insets left="20.0" top="20.0" />
</HBox.margin>
</Button>
</children>
</HBox>
</bottom>
<center>
<Label fx:id="zeitAnzeige" text="00:00:00" textAlignment="CENTER" BorderPane.alignment="CENTER_LEFT">
<font>
<Font name="Cantarell Regular" size="96.0" />
</font>
<padding>
<Insets left="45.0" />
</padding>
</Label>
</center>
<top>
<MenuBar BorderPane.alignment="CENTER">
<menus>
<Menu mnemonicParsing="false" text="Aktion">
<items>
<MenuItem fx:id="menuItemStart" mnemonicParsing="false" onAction="#menuItemStartAction" text="Start" />
<MenuItem fx:id="menuItemReset" mnemonicParsing="false" onAction="#menuItemResetAction" text="Reset" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem fx:id="menuItemClose" mnemonicParsing="false" onAction="#menuItemCloseAction" text="Beenden" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Hilfe">
<items>
<MenuItem fx:id="menuItemHilfe" mnemonicParsing="false" onAction="#menuItemHilfeAction" text="Info" />
</items>
</Menu>
</menus>
</MenuBar>
</top>
</BorderPane>
</children>
</AnchorPane>

10
src/main/java/com/Stoppuhr/application/Main.java

@ -67,8 +67,12 @@ public class Main extends Application
public void start(Stage primaryStage)
{
try {
FXMLLoader loader = new FXMLLoader(
getClass().getResource("/fxml/MainWindow.fxml"));
FXMLLoader loader = new FXMLLoader();
//TODO Path
loader.setLocation(Main.class.getResource("../../../../resources/fxml/MainWindow.fxml"));
//System.out.println(Main.class.getResource("../../../../resources/fxml/MainWindow.fxml").toString());
//System.exit(1);
AnchorPane pane = loader.load();
primaryStage.setTitle("Stoppuhr");
Scene scene = new Scene(pane);
@ -77,7 +81,7 @@ public class Main extends Application
*
*/
scene.getStylesheets().add(
Main.class.getResource("/css/application.css").toExternalForm());
Main.class.getResource("../../../../resources/css/application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close