diff --git a/src/main/java/fr/univ_amu/iut/admin2/Controller.java b/src/main/java/fr/univ_amu/iut/admin2/Controller.java new file mode 100644 index 0000000..2a49c0e --- /dev/null +++ b/src/main/java/fr/univ_amu/iut/admin2/Controller.java @@ -0,0 +1,108 @@ +package fr.univ_amu.iut.admin2; + +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.*; +import javafx.scene.layout.AnchorPane; + +import java.net.URL; +import java.util.ResourceBundle; + +public class Controller implements Initializable { + @FXML + private Button addActeurs; + @FXML + private AnchorPane acteurs; + + @FXML + private Button addRessources; + @FXML + private AnchorPane ressources; + + @FXML + private MenuButton menuButton; + @FXML + private TextArea textMenuButton; + @FXML + MenuItem id1; + @FXML + MenuItem id2; + @FXML + MenuItem id3; + + private int cptActeur = 1; + private int cptRessource = 1; + + private void addActeur(){ + TextField nom = new TextField(); + TextField type = new TextField(); + + nom.setId(String.format("nomActeur%s",cptActeur)); + nom.setLayoutX(13); + nom.setLayoutY(16+cptActeur*10+cptActeur*36); + nom.setPrefHeight(36); + nom.setPrefWidth(240); + nom.resize(36 ,240); + nom.setPromptText("Nom"); + + type.setId(String.format("typeActeur%s",cptActeur)); + type.setLayoutX(310); + type.setLayoutY(16+cptActeur*10+cptActeur*36); + type.setPrefHeight(36); + type.setPrefWidth(240); + type.resize(36 ,240); + type.setPromptText("Type"); + + + acteurs.getChildren().addAll(nom,type); + acteurs.resize(acteurs.getHeight()+46,acteurs.getWidth()); + acteurs.setPrefHeight(acteurs.getHeight()+62); + ++cptActeur; + + } + private void addRessource(){ + TextField nom = new TextField(); + TextField lien = new TextField(); + TextField type = new TextField(); + + nom.setId(String.format("nomRessource%s",cptRessource)); + nom.setLayoutX(13); + nom.setLayoutY(18+cptRessource*10+cptRessource*36); + nom.setPrefHeight(36); + nom.setPrefWidth(170); + nom.resize(36 ,170); + nom.setPromptText("Nom"); + + lien.setId(String.format("lineRessource%s",cptRessource)); + lien.setLayoutX(199); + lien.setLayoutY(18+cptRessource*10+cptRessource*36); + lien.setPrefHeight(36); + lien.setPrefWidth(170); + lien.resize(36 ,170); + lien.setPromptText("Lien"); + + type.setId(String.format("typeRessource%s",cptRessource)); + type.setLayoutX(379); + type.setLayoutY(18+cptRessource*10+cptRessource*36); + type.setPrefHeight(36); + type.setPrefWidth(170); + type.resize(36 ,170); + type.setPromptText("Type"); + + ressources.getChildren().addAll(nom,type,lien); + ressources.resize(ressources.getHeight()+46,ressources.getWidth()); + ressources.setPrefHeight(ressources.getHeight()+62); + ++cptRessource; + } + + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + addActeurs.setOnAction(actionEvent -> addActeur()); + addRessources.setOnAction(actionEvent -> addRessource()); + id1.setOnAction(actionEvent -> textMenuButton.setPromptText("Degrès 1")); + id2.setOnAction(actionEvent -> textMenuButton.setPromptText("Degrès 2")); + id3.setOnAction(actionEvent -> textMenuButton.setPromptText("Degrès +")); + } +} diff --git a/src/main/java/fr/univ_amu/iut/admin2/Main.java b/src/main/java/fr/univ_amu/iut/admin2/Main.java new file mode 100644 index 0000000..4806772 --- /dev/null +++ b/src/main/java/fr/univ_amu/iut/admin2/Main.java @@ -0,0 +1,26 @@ +package fr.univ_amu.iut.admin2; + + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.layout.AnchorPane; +import javafx.stage.Stage; + + + +public class Main extends Application { + + public static void main(String[] args) {launch(args);} + @Override + public void start(Stage stage) throws Exception { + try { + AnchorPane root = FXMLLoader.load(getClass().getResource("/fr/univ_amu/iut/admin2/admin2.fxml")); + stage.setScene(new Scene(root)); + stage.show(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} + diff --git a/src/main/java/fr/univ_amu/iut/admin2/admin2.fxml b/src/main/java/fr/univ_amu/iut/admin2/admin2.fxml new file mode 100644 index 0000000..07e4ad0 --- /dev/null +++ b/src/main/java/fr/univ_amu/iut/admin2/admin2.fxml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +