1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
public class EcranDeDemarrage implements Initializable {
//=======================================================================
@FXML
private Button previousButtonVariable;
@FXML
private Button nextButtonVariable;
@FXML
private Button ajouterCategorieVariable;
@FXML
private Button ajouterLienVariable;
@FXML
private Button afficherCategorieVariable;
@FXML
private Button manuelUtilisationVariable;
@FXML
private Button ecranAccueilVariable;
@FXML
private BorderPane borderPane;
//=======================================================================
private String currentState; // represente dans quelle interface on se situe a un moment donne
private String previousState; //
private String nextState;
private Stage stageFromClass = new Stage();
public void pointDeDepart(Stage stage) throws IOException {
this.stageFromClass = stage;
FXMLLoader fxmlLoader = new FXMLLoader(RunMe.class.getResource("ecranAccueil.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 650, 270);
// pour mettre un logo
String path = "C:\\Users\\yacin\\OneDrive\\Desktop\\sources_classification java project\\src\\demonslayer.png";
File file = new File(path);
String localUrl = file.toURI().toURL().toString();
Image image = new Image(localUrl, false);
stage.getIcons().add(image);
// fin logo
stage.setTitle("Classifieur");
stage.setScene(scene);
stage.setMaximized(true);
stage.show();
}
@FXML
protected void ajouterCategorie() {
changerInterface("ajouterCategorie");
}
@FXML
protected void ajouterLien() {
changerInterface("ajouterLien");
}
@FXML
protected void afficherCategorie() {
changerInterface("afficherCategories");
}
@FXML
protected void manuelUtilisation()
{
changerInterface("manuelUtilisation");
}
@FXML
protected void ecranAccueil(){
changerInterface("ecranAccueil");
}
//------------------------------------------------------------------------------------------------
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
String ss = "nextButton.png";
String ss2 = "previousButton.png";
f1(ss,nextButtonVariable);
f1(ss2,previousButtonVariable);
f2(previousButtonVariable,65,10);
f2(nextButtonVariable, 65,10);
f2(ajouterCategorieVariable, 140,350);
f2(ajouterLienVariable, 140,350);
f2(afficherCategorieVariable, 140,350);
manuelUtilisationVariable.setPrefSize(140,350);
}
private void changerInterface(String interfaceEntree) {
Parent root = null;
try {
root = FXMLLoader.load(getClass().getResource(interfaceEntree + ".fxml"));
} catch(IOException ex) {
System.out.println("il y a une erreur dans 'changer interface'");
}
borderPane.setCenter(root);
}
private void f1(String ss, Button button)
{
String path = "C:\\Users\\yacin\\OneDrive\\Desktop\\sources_classification java project\\src\\" + ss ;
Image image = new Image(path);
ImageView imageView = new ImageView(image);
imageView.setFitHeight(20);
imageView.setPreserveRatio(true);
button.setGraphic(imageView);
}
private void f2(Button button, double longueur, double largeur)
{
button.prefWidthProperty().bind(borderPane.widthProperty());
button.prefWidthProperty().bind(borderPane.heightProperty());
button.setMaxSize(longueur,largeur);
}
} |
Partager