我目前正在为一个学校项目尝试 JavaFX。虽然这对我来说并不是一个真正的问题,但有时将 @FXML 标记放在每个声明之前会让我感到恼火,如下所示:
@FXML ListView accountsList;
@FXML ListView videosList;
@FXML ListView quizItems;
@FXML Label account_name;
@FXML Label account_quiz;
@FXML Label video_title;
@FXML Label video_desc;
@FXML Label item_a;
@FXML Label item_b;
@FXML Label item_c;
@FXML Label item_question;
为什么我不能这样做?
@FXML Label lbl1, lbl2, lbl3; // only lbl3 works, but the others not
// (lbl1, lbl2 is not detected in JavaFX SceneBuilder)
...或者正确的方法是什么?谢谢并原谅我的英语语法。:)