avancé sur l'interface

This commit is contained in:
lucas Muratet 2022-05-24 15:16:28 +02:00 committed by imuny
parent 617aca89db
commit d026ecf905
3 changed files with 86 additions and 10 deletions

View File

@ -0,0 +1,11 @@
package fr.univ_amu.iut.fp;
import fr.univ_amu.iut.view.map.AcademiePath;
import fr.univ_amu.iut.view.map.France;
import fr.univ_amu.iut.view.map.FranceBuilder;
import javafx.fxml.FXML;
import javafx.scene.layout.StackPane;
public class Controlle {
}

View File

@ -0,0 +1,57 @@
package fr.univ_amu.iut.fp;
import fr.univ_amu.iut.view.map.AcademiePath;
import fr.univ_amu.iut.view.map.France;
import fr.univ_amu.iut.view.map.FranceBuilder;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javax.xml.namespace.QName;
public class Main extends Application {
France france;
@FXML
private StackPane stackPaneFrance ;
private void initFrance(){
france = FranceBuilder.create()
// .backgroundColor(Color.web("#4aa9d7"))
//.fillColor(Color.web("#dcb36c"))
//.strokeColor(Color.web("#987028"))
//.hoverColor(Color.web("#fec47e"))
//.pressedColor(Color.web("#6cee85"))
//.selectedColor(Color.MAGENTA)
.mousePressHandler(evt -> {
AcademiePath academiePath = (AcademiePath) evt.getSource();
System.out.println("On vient de cliquer sur l'"+academiePath.getAcademie().getNom());
})
.selectionEnabled(true)
.build();
stackPaneFrance.getChildren().addAll(france);
}
@Override
public void start(Stage primaryStage) throws Exception {
AnchorPane root = FXMLLoader.load(getClass().getResource("/fr/univ_amu/iut/fp/fp.fxml"));
// initFrance();
primaryStage.setTitle("Carte des académie");
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
public static void main(String[] args) {launch(args);}
}

View File

@ -1,14 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="fr.univ_amu.iut.fp.Fp"
prefHeight="400.0" prefWidth="600.0">
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.StackPane?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: none;" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.univ_amu.iut.fp.Main">
<children>
<AnchorPane prefHeight="64.0" prefWidth="600.0" style="-fx-background-color: gray;">
<children>
<TextField id="barre de recherche " layoutX="114.0" layoutY="19.0" prefHeight="27.0" prefWidth="372.0" promptText="Search" style="-fx-border-color: blue; -fx-border-width: gray; -fx-border-radius: 5em; -fx-background-radius: 5em;" text="Search">
<cursor>
<Cursor fx:constant="CROSSHAIR" />
</cursor>
</TextField>
</children>
</AnchorPane>
<StackPane id="stackPaneFrance" layoutX="47.0" layoutY="125.0" prefHeight="150.0" prefWidth="200.0" style="-fx-background-color: blue;" />
<StackPane layoutX="348.0" layoutY="125.0" prefHeight="150.0" prefWidth="200.0" style="-fx-background-color: blue;" />
</children>
</AnchorPane>