Lukas Reichwein
6 years ago
4 changed files with 145 additions and 2 deletions
-
45src/main/java/com/ugsbo/gui/BasicGuiController.java
-
57src/main/java/com/ugsbo/gui/MainApp.java
-
41src/main/resources/com/ugsbo/gui/BasicGui.fxml
-
4src/main/resources/com/ugsbo/gui/styles.css
@ -0,0 +1,45 @@ |
|||
package com.ugsbo.gui; |
|||
|
|||
import javafx.fxml.FXML; |
|||
import javafx.scene.control.*; |
|||
|
|||
public class BasicGuiController { |
|||
|
|||
//Hier werden die fx:id Attribute verknuepft. |
|||
@FXML |
|||
private Button app1; //Fuer ToDoManager. |
|||
@FXML |
|||
private Button app2; |
|||
@FXML |
|||
private Button app3; |
|||
@FXML |
|||
private Button app4; |
|||
|
|||
/** |
|||
* Konstructor is called before initialize() |
|||
*/ |
|||
public BasicGuiController() { |
|||
//Setup of some Fields could be defined here. |
|||
} |
|||
|
|||
/** |
|||
* Initializes the controller class. This method is automatically called after |
|||
* the fxml file has been loaded. |
|||
*/ |
|||
@FXML |
|||
public void initialize() { |
|||
app1.setOnMouseClicked((event) -> { |
|||
//MainApp.startToDoMainGui(); |
|||
System.out.println(event); |
|||
}); |
|||
app2.setOnMouseClicked((event) -> { |
|||
System.out.println(event); |
|||
}); |
|||
app3.setOnMouseClicked((event) -> { |
|||
System.out.println(event); |
|||
}); |
|||
app4.setOnMouseClicked((event) -> { |
|||
System.out.println(event); |
|||
}); |
|||
} |
|||
} |
@ -1,8 +1,61 @@ |
|||
package com.ugsbo.gui; |
|||
|
|||
public class MainApp { |
|||
import java.io.IOException; |
|||
|
|||
import javafx.application.Application; |
|||
import javafx.fxml.FXMLLoader; |
|||
import javafx.scene.*; |
|||
import javafx.stage.Stage; |
|||
|
|||
/** |
|||
* Runs the main Application and handles the loading of an FXML file. |
|||
*/ |
|||
public class MainApp extends Application { |
|||
|
|||
/** |
|||
* The main() method is ignored in correctly deployed JavaFX application. main() |
|||
* serves only as fallback in case the application can not be launched through |
|||
* deployment artifacts, e.g., in IDEs with limited FX support. NetBeans ignores |
|||
* main(). |
|||
* |
|||
* @param args the command line arguments |
|||
*/ |
|||
public static void main(String[] args) { |
|||
System.out.println("HelloWorld!"); |
|||
launch(args); |
|||
} |
|||
|
|||
/** |
|||
* Starts the Main GUI, will be called from JavaFx. |
|||
*/ |
|||
@Override |
|||
public void start(Stage stage) { |
|||
createStageFromFXML(stage, "BasicGui"); |
|||
} |
|||
|
|||
/** |
|||
* Loades the FXML file and the Default CSS. |
|||
* |
|||
* @param stage The Stage will be passed over from fxml |
|||
* @param fxmlFileName Only the Filename of the fxml file wich sould be loaded |
|||
*/ |
|||
private void createStageFromFXML(Stage stage, String fxmlFileName) { |
|||
// Gettring the FXML loader to load the File. |
|||
FXMLLoader loader = new FXMLLoader(getClass().getResource(fxmlFileName + ".fxml")); |
|||
Parent root; |
|||
// trying to load the FXML and CSS file for the GUI with the fxmlFileName. |
|||
try { |
|||
root = loader.load(); |
|||
Scene basicGUI = new Scene(root); |
|||
basicGUI.getStylesheets().add(getClass().getResource("styles.css").toExternalForm()); |
|||
// Setting the Title of the |
|||
stage.setTitle("Ultra geile Studenten Benutzeroberfläche"); |
|||
// set Resizeable to false, in oder to block resizeing though the User. |
|||
stage.setResizable(false); |
|||
stage.setScene(basicGUI); |
|||
} catch (IOException e) { |
|||
System.out.println(".FXML or .css File can not be found."); |
|||
e.printStackTrace(); |
|||
} |
|||
stage.show(); |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<?import javafx.geometry.*?> |
|||
<?import javafx.scene.paint.*?> |
|||
<?import javafx.scene.control.*?> |
|||
<?import javafx.scene.text.*?> |
|||
<?import java.lang.*?> |
|||
<?import javafx.scene.layout.*?> |
|||
|
|||
|
|||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="400.0" minWidth="600.0" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ugsbo.gui.BasicGuiController"> |
|||
<children> |
|||
<AnchorPane maxHeight="50.0" minHeight="50.0" minWidth="-Infinity" prefHeight="50.0" prefWidth="600.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> |
|||
<children> |
|||
<Label text="UGSBO" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="10.0" /> |
|||
<TextField layoutX="415.0" layoutY="13.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="13.0" /> |
|||
</children> |
|||
</AnchorPane> |
|||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="140.0" minWidth="-Infinity" prefHeight="350.0" prefWidth="150.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="50.0"> |
|||
<children> |
|||
<Label layoutX="43.0" layoutY="14.0" text="Team O.o" AnchorPane.leftAnchor="43.0" AnchorPane.rightAnchor="43.0" AnchorPane.topAnchor="10.0" /> |
|||
<Label layoutX="22.0" layoutY="50.0" text="Christian Baltzer" AnchorPane.topAnchor="40.0" /> |
|||
<Label layoutX="14.0" layoutY="71.0" text="Carolin Brückmann" AnchorPane.topAnchor="71.0" /> |
|||
<Label layoutX="19.0" layoutY="109.0" text="Jacqueline Heinze" AnchorPane.topAnchor="100.0" /> |
|||
<Label layoutX="22.0" layoutY="130.0" text="Lukas Reichwein" AnchorPane.topAnchor="130.0" /> |
|||
</children> |
|||
</AnchorPane> |
|||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="150.0" AnchorPane.topAnchor="50.0"> |
|||
<children> |
|||
<Button fx:id="app1" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="30.0" prefWidth="260.0" text="ToDoListe" textAlignment="CENTER" AnchorPane.leftAnchor="19.0" AnchorPane.rightAnchor="19.0" AnchorPane.topAnchor="15.0" /> |
|||
<Button fx:id="app2" maxHeight="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="30.0" prefWidth="260.0" text="App2" textAlignment="CENTER" AnchorPane.leftAnchor="19.0" AnchorPane.rightAnchor="19.0" AnchorPane.topAnchor="60.0" /> |
|||
<Button fx:id="app3" maxHeight="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="30.0" prefWidth="260.0" text="App3" textAlignment="CENTER" AnchorPane.leftAnchor="19.0" AnchorPane.rightAnchor="19.0" AnchorPane.topAnchor="105.0" /> |
|||
<Button fx:id="app4" maxHeight="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="30.0" prefWidth="260.0" text="App4" textAlignment="CENTER" AnchorPane.leftAnchor="19.0" AnchorPane.rightAnchor="19.0" AnchorPane.topAnchor="150.0" /> |
|||
</children> |
|||
<opaqueInsets> |
|||
<Insets /> |
|||
</opaqueInsets> |
|||
</AnchorPane> |
|||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="150.0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="50.0" /> |
|||
</children> |
|||
</AnchorPane> |
@ -0,0 +1,4 @@ |
|||
.button { |
|||
-fx-font-weight: bold; |
|||
font-weight: bold; |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue