我将测试更改为 TestFx,但问题仍然存在。
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/ILAreaManagement/ILArea.fxml"));
Parent root = fxmlLoader.load();
MaintenanceController maintenanceController = fxmlLoader.getController();
Platform.runLater(() ->{
try {
maintenanceController.initialize(maintenanceAreaObjectObservableList);
} catch (Exception e) {
当涉及到 setTitle 方法时,它给出了
java.lang.NoSuchMethodError: gov.tubitak.ys03.sysmaintenance.utilities.BorderedTitledPane.setTitle(Ljava/lang/String;)V
((BorderedTitledPane)ILAreaPane).setTitle("IL 区域");
public class BorderedTitledPane extends StackPane {
Label title = new Label(" ");
public BorderedTitledPane(Node content) {
StackPane contentPane = new StackPane();
content.getStyleClass().add("bordered-titled-content");
contentPane.getChildren().add(content);
getStyleClass().add("bordered-titled-border");
getChildren().addAll(title, contentPane);
}
public void setTitle(String title) {
this.title.setText(title);
this.title.getStyleClass().add("bordered-titled-title");
StackPane.setAlignment(this.title, Pos.TOP_CENTER);
}
}
我将 setTitle 更改为 public Label getTitle(){return title;} 但我得到与 Ljavafx/scene/control/Label 相同的错误。我不明白异常的原因。