Bonjour à tous.


Je suis débutant en java.

J'essai de faire une interface utilisateur avec JavaFX.

Mon problème est que j'ai des erreurs à la compilation :
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
Executing C:\Users\Florent\Documents\NetBeansProjects\TasksList\dist\run1007862620\TasksList.jar using platform C:\Program Files\Java\jdk1.8.0_152\jre/bin/javaException in Application start method
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
	at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(LauncherImpl.java:182)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Children: duplicate children added: parent = Grid hgap=0.0, vgap=0.0, alignment=TOP_LEFT
	at javafx.scene.Parent$2.onProposedChange(Parent.java:454)
	at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:206)
	at TasksPackage.MainTasksList.start(MainTasksList.java:108)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
	at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
	... 1 more
Exception running application TasksPackage.MainTasksList
Java Result: 1
Voici mon code :
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
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
122
123
124
125
126
127
128
package TasksPackage;
 
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
 
 
/**
 *
 * @author Flow
 */
public class MainTasksList extends Application {
 
    @Override
    public void start(Stage primaryStage) {
 
 
 
        GridPane root = new GridPane();
 
        GridPane progressTasks = new GridPane(); // root 0,0
        GridPane progressTasksDetails = new GridPane(); // progressTasks 1,0
        GridPane newTask = new GridPane(); // root 0,2
 
        ListView lvTasks = new ListView(); // progressTasks 0,0
 
 
        Label lblProgressTaskName = new Label("Nom : "); // progressTasksDetails 0,0
        Label lblProgressTaskDescription = new Label("Description : "); // progressTasksDetails 0,1
        Label lblNewTaskName = new Label("Nom :"); // newTask 0,0
        Label lblNewTaskDescription = new Label("Description : "); // newTask 0,1
        Label lblAddNewTasl = new Label("Ajouter une tache"); // root 0,1
 
        TextField tfProgressTaskName = new TextField(); // progressTasksDetails 1,0
        TextField tfNewTaskName = new TextField(); // newTask 0,1
 
        TextArea taProgressTaskDescription = new TextArea(); // progressTasksDetails 1,1
        TextArea taNewTaskDescription = new TextArea(); // newTask 1,1
 
 
        final ToggleGroup RbProgressGroup = new ToggleGroup();
        RadioButton rbProgressTaskToDo = new RadioButton("A faire"); // progressTasksDetails 0,2
        rbProgressTaskToDo.setToggleGroup(RbProgressGroup);
        RadioButton rbProgressTaskDone = new RadioButton("Terminée"); // progressTasksDetails 1,2
        rbProgressTaskDone.setToggleGroup(RbProgressGroup);
        final ToggleGroup RbNewGroup = new ToggleGroup();
        RadioButton rbNewTaskTodo = new RadioButton("A faire"); // newTask 0,2
        rbNewTaskTodo.setToggleGroup(RbNewGroup);
        RadioButton rbNewTaskDone = new RadioButton("Terminée"); // newTask 1,2
        rbNewTaskDone.setToggleGroup(RbNewGroup);
 
        Button btnDelete = new Button("Supprimer"); // progressTasksDetails 0,3
        Button btnAdd = new Button("Ajouter"); // newTask 0,3
 
 
 
        root.setConstraints(progressTasks, 0, 0);
        root.add(lblAddNewTasl, 0, 1);
        root.setConstraints(newTask, 0, 2);
 
        progressTasks.add(lvTasks, 0,0);
        progressTasks.setConstraints(progressTasksDetails, 1,0);
 
        progressTasksDetails.add(lblProgressTaskName, 0,0);
        progressTasksDetails.add(tfProgressTaskName, 1,0);
        progressTasksDetails.add(lblProgressTaskDescription, 0,1);
        progressTasksDetails.add(taProgressTaskDescription, 1,1);
        progressTasksDetails.add(rbProgressTaskToDo, 0,2);
        progressTasksDetails.add(rbProgressTaskDone, 1,2);
        progressTasksDetails.add(btnDelete, 0,3);
 
        newTask.add(lblNewTaskName, 0,0);
        newTask.add(tfNewTaskName, 1,0);
        newTask.add(lblNewTaskDescription, 0,1);
        newTask.add(taNewTaskDescription, 1,1);
        newTask.add(rbNewTaskTodo, 0,2);
        newTask.add(rbNewTaskDone, 1,2);
        newTask.add(btnAdd, 0,3);
 
 
 
        root.getChildren().add(progressTasks);
        root.getChildren().add(progressTasksDetails);
        root.getChildren().add(newTask);
        root.getChildren().add(lvTasks);
        root.getChildren().add(lblProgressTaskName);
        root.getChildren().add(lblProgressTaskDescription);
        root.getChildren().add(lblNewTaskName);
        root.getChildren().add(lblNewTaskDescription);
        root.getChildren().add(lblAddNewTasl);
        root.getChildren().add(tfProgressTaskName);
        root.getChildren().add(tfNewTaskName);
        root.getChildren().add(taProgressTaskDescription);
        root.getChildren().add(taNewTaskDescription);
        root.getChildren().add(rbProgressTaskToDo);
        root.getChildren().add(rbProgressTaskDone);
        root.getChildren().add(rbNewTaskTodo);
        root.getChildren().add(rbNewTaskDone);
        root.getChildren().add(btnDelete);
        root.getChildren().add(btnAdd);
 
 
 
        Scene scene = new Scene(root, 1000, 800);
 
 
        primaryStage.setTitle("Liste de tâches à faire");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
 
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
 
}

Malgré différentes recherches, je ne trouve pas de solution.
C'est peut être un truc tout bête (ou pas).

Merci d'avance pour votre aide.

Pour info, j'utilise NetBeans 8.2

Au plaisir de vous lire.