1.尝试在弹出窗口中显示异常消息。异常消息未显示。弹出窗口标签未加载
2.Eg:当我点击按钮的弹出窗口(二FXML文件)是在标签
3.Popup窗口出现在用正确的异常信息加载,但标签没有加载(加粗一个 - >ExceptionLabel.setText(“请输入正确的文件路径”))它说空指针异常。
4.我不知道我缺少什么。同样在FX:ID中声明,也在第二个fxml文件中链接主控制器。提前致谢。
@FXML
public Label ExceptionLabel;
Stage PopupWindow = new Stage();
public void Buttonhandle(ActionEvent event) throws IOException {
try {
if(ESBOutboundFile!=null && OutputFile!=null){
String Output = SBlogpaser.Logpaser(ESBInboundFile,ESBOutboundFile,OutputFile);
System.out.println(Output);
}else{
Window(PopupWindow);
**ExceptionLabel.setText("Please enter Proper file path");**
}
} catch (Exception ex) {
System.out.println(ex);
}
}
public void Window(Stage Popup) throws Exception {
this.Popup=Popup;
final FXMLLoader fxmlLoader = new FXMLLoader();
Parent root= fxmlLoader.load(getClass().getResource("POPUPWindow.fxml"));
Scene scene1 = new Scene(root);
Popup.setScene(scene1);
Popup.show();
}
如果我保持标签中得到显示为 “OK” 按钮,手柄。
仍然无法正常工作....... – mani
您使用了PopupController方法,并且exceptionLabel仍然为空? –
这次更好没有例外,但消息没有得到显示..代码正确调用popupcontroller,但它没有传递给公共无效initialize()方法。如果手动调用它将引发标签设置文本的空指针异常 – mani