我正在重構此問題 - 從另一個問題進行編輯。java.lang.NoClassDefFoundError:javax/mail/Authenticator - 導致fxml頁面不加載
當我登錄到程序並雙擊tableView中的一個項目時,我沒有在應該彈出的新選項卡上得到任何東西。該Main.fxml顯示精細,這意味着MainController似乎運作良好,圖片:
當您在一行雙擊它應該看起來像:
但這種情況正在發生:
要告訴你如何代碼調用,它在形式名爲.java的偉大工程,但是當它被編譯它打破:
Tab tab = new Tab();
tabs.getTabs().add(tab);
tab.setText(tableView.getSelectionModel().getSelectedItem().getDescription());
// loads the previously instantiated version of the Item.fxml resource
FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("fxml/Item.fxml"));
tab.setContent((Node) loader.load());
date = dateLbl.getText();
time = timeLbl.getText();
user = userLbl.getText();
SingleSelectionModel<Tab> selectionModel = tabs.getSelectionModel();
selectionModel.select(tab);
// creates an ItemController object and passes through the results of the database query and stores them as variables in the ItemController, also sets the database to aseptic
ItemController controller = loader.<ItemController>getController();
controller.setTextItems(id, manufacturer_name, model_number, vendor_name, vendor_part_number, tolmar_part_number, part_location, price, quantity, min, max, img, equipment_group, equipment_id, additional_notes, description);
controller.setUserVariables(user, time, date);
controller.setDBState(aseptic);
正如你在第二圖像(程序應該當打開方式的右下角看到我雙擊一行),我可以添加或刪除項目。當這個項目達到最低限度時,它會自動生成一封電子郵件,讓我知道我還需要訂購多少。我相信這個功能無法正常工作,並可能導致整個頁面無法加載?我回顧了其他類似的問題,嘗試了一些沒有運氣的建議,我添加了mail.jar和activation.jar文件,並將它們添加到我的POM中(請參見下文)。我覺得我已經非常接近讓這個代碼在真實世界中實際工作,請幫助,謝謝!
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>