diff --git a/pom.xml b/pom.xml index 23ed44cc5520d5020e679c3c239789bf438147fc..f60ab18f23092ff047a83a90c234ef069675a73d 100644 --- a/pom.xml +++ b/pom.xml @@ -7,12 +7,56 @@ <groupId>ch.hepia.etu</groupId> <artifactId>tp4</artifactId> <version>0.0.1-SNAPSHOT</version> + <name>HepiaNet</name> - <!-- Forcing java 10 --> + <!-- Forcing java 11 --> <properties> - <maven.compiler.source>10</maven.compiler.source> - <maven.compiler.target>10</maven.compiler.target> + <maven.compiler.source>11</maven.compiler.source> + <maven.compiler.target>11</maven.compiler.target> + <org.springframework.version>4.0.6.RELEASE</org.springframework.version> </properties> + <dependencies> + <!-- Java FX --> + <dependency> + <groupId>org.openjfx</groupId> + <artifactId>javafx-controls</artifactId> + <version>11</version> + </dependency> + <dependency> + <groupId>org.openjfx</groupId> + <artifactId>javafx-fxml</artifactId> + <version>11</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <release>11</release> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.6.0</version> + <executions> + <execution> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>ch.hepia.etu.socialnetwork.Main</mainClass> + </configuration> + </plugin> + </plugins> + </build> + </project> \ No newline at end of file diff --git a/src/main/java/ch/hepia/etu/socialnetwork/Main.java b/src/main/java/ch/hepia/etu/socialnetwork/Main.java index 6daf8067345bf1155364c6ccd68dcb3bcf54f737..d1924c0503e06092609475fc35be502770fec54a 100644 --- a/src/main/java/ch/hepia/etu/socialnetwork/Main.java +++ b/src/main/java/ch/hepia/etu/socialnetwork/Main.java @@ -1,39 +1,34 @@ package ch.hepia.etu.socialnetwork; import javafx.application.Application; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.geometry.Rectangle2D; -import javafx.scene.Group; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.paint.Color; -import javafx.stage.Screen; import javafx.stage.Stage; +import java.io.IOException; + + +/** + * Starts up the app. + */ public class Main extends Application { - public static void main(String... args) { - Application.launch(Main.class, args); + + /** + * Main starter + * @param args The passed arguments + */ + public static void main(String[] args) { + launch(args); } @Override - public void start(Stage primaryStage) { - primaryStage.setTitle("HepiaNet"); - Group root = new Group(); - Rectangle2D scr = Screen.getPrimary().getBounds(); - Scene scene = new Scene(root, scr.getWidth() / 2, scr.getHeight() / 4, Color.LIGHTGREEN); - Button btn = new Button(); - btn.setLayoutX(100); - btn.setLayoutY(80); - btn.setText("Hello World"); - btn.setOnAction(new EventHandler<ActionEvent>() { + public void start(Stage stage) throws IOException { + Parent root = FXMLLoader.load(Main.class.getResource("/fxml/ConnectionWindow.fxml")); + Scene scene = new Scene(root, 1000, 565); - public void handle(ActionEvent event) { - System.out.println("Hello World"); - } - }); - root.getChildren().add(btn); - primaryStage.setScene(scene); - primaryStage.show(); + stage.setTitle("Hepia Net"); + stage.setScene(scene); + stage.show(); } } diff --git a/src/main/java/ch/hepia/etu/socialnetwork/ui/ConnectionController.java b/src/main/java/ch/hepia/etu/socialnetwork/ui/ConnectionController.java new file mode 100644 index 0000000000000000000000000000000000000000..6aaa1b94e3986c0e2f6cf06fd8d11fa32d9bc124 --- /dev/null +++ b/src/main/java/ch/hepia/etu/socialnetwork/ui/ConnectionController.java @@ -0,0 +1,4 @@ +package ch.hepia.etu.socialnetwork.ui; + +public class ConnectionController { +} diff --git a/src/main/resources/fxml/ConnectionWindow.fxml b/src/main/resources/fxml/ConnectionWindow.fxml new file mode 100644 index 0000000000000000000000000000000000000000..6201bd3a6f22ac8fa8076340868b728f2520c67b --- /dev/null +++ b/src/main/resources/fxml/ConnectionWindow.fxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.geometry.*?> +<?import javafx.scene.shape.*?> +<?import javafx.scene.text.*?> +<?import javafx.scene.control.*?> +<?import java.lang.*?> +<?import javafx.scene.layout.*?> + +<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="565.0" prefWidth="1000.0" style="-fx-background-color: #bababa;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> + <top> + <Label alignment="CENTER" contentDisplay="CENTER" prefHeight="80.0" prefWidth="1000.0" style="-fx-background-color: #35B1EE;" text="AppNameLabel" textAlignment="CENTER" textFill="WHITE" BorderPane.alignment="CENTER"> + <font> + <Font size="35.0" /> + </font> + </Label> + </top> + <center> + <GridPane BorderPane.alignment="CENTER"> + <columnConstraints> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> + </columnConstraints> + <rowConstraints> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> + </rowConstraints> + <children> + <ProgressIndicator maxHeight="50.0" maxWidth="50.0" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" /> + <Label alignment="CENTER" style="-fx-padding: 10px;" text="AppConnectionStatusLabel" textAlignment="CENTER" textFill="WHITE" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="BASELINE" /> + </children> + </GridPane> + </center> +</BorderPane>