Bonjour,

j'ai remarquer que mon petit programme en JavaFX fonctionne dans Netbeans mais lorsque je vais dans le dossier 'dist" et que je lance le .jar il ne se passe rien ? voici mon code :

le Controller :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
package gestionreparation;
 
import javafx.fxml.FXML;
 
public class Controller {
 
 
    // Méthode d'initialisation
    @FXML
    public void initialize() {
 
    }
}
le sampl.fxml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
<?xml version="1.0" encoding="UTF-8"?>
 
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
 
<AnchorPane fx:id="anchorpane1" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="950.0" style="-fx-background-color: #FFFFFF;" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gestionreparation.Controller">
   <children>
      <TableView editable="true" layoutX="14.0" layoutY="396.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="290.0" prefWidth="930.0" tableMenuButtonVisible="true" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="395.0">
        <columns>
          <TableColumn prefWidth="75.0" text="C1" />
          <TableColumn prefWidth="75.0" text="C2" />
        </columns>
      </TableView>
      <TabPane layoutX="4.0" layoutY="14.0" prefHeight="378.0" prefWidth="940.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0">
        <tabs>
          <Tab text="Envoi">
               <content>
                  <AnchorPane prefHeight="200.0" prefWidth="200.0">
                     <children>
                        <VBox layoutX="26.0" layoutY="29.0" prefHeight="300.0" prefWidth="100.0" style="-fx-background-color: linear-gradient(to bottom, #FF7E5F, #FEB47B);;" AnchorPane.topAnchor="25.0" />
                     </children>
                  </AnchorPane>
               </content>
            </Tab>
          <Tab text="Retour">
               <content>
                  <AnchorPane prefHeight="200.0" prefWidth="200.0" />
               </content>
            </Tab>
            <Tab text="Edition Document">
              <content>
                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
              </content>
            </Tab>
        </tabs>
      </TabPane>
   </children>
</AnchorPane>
et le main :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
package gestionreparation;
 
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
 
public class GestionReparation extends Application {
 
    @Override
    public void start(Stage primaryStage) throws Exception {
        // Chargement de la fenêtre depuis le fichier FXML
        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
        primaryStage.setTitle("Gestion des réparations");
 
        // Définir la scène avec une taille initiale
        primaryStage.setScene(new Scene(root, 1200, 700));
 
        // Afficher la fenêtre
        primaryStage.show();
    }
 
    public static void main(String[] args) {
        launch(args);
    }
 
}