每当报告阶段关闭时,主阶段就会关闭
Main stage is getting closed whenever the report stage is getting closed
在我的 javafx 应用程序中,我使用 DynamicReports,它是免费和开源的 Java 报告工具。在我的按钮事件代码中,我调用了一种方法来显示报告:
report1.setOnAction(event -> {
getSupplierListReport();
}
);
这是方法:
public void getSupplierListReport()
{
report = DynamicReports.report();
try {
//show the report
report
.columns(
Columns.reportRowNumberColumn("No"),
Columns.column("First Name", "f_name", DataTypes.stringType()),
Columns.column("Last Name", "l_name", DataTypes.stringType()),
Columns.column("Email", "email", DataTypes.stringType())
)
.title(//title of the report
Components.text("Supplier List Report")
.setHorizontalAlignment(HorizontalAlignment.CENTER).setStyle(boldCenteredStyle))
.pageFooter(Components.pageXofY().setStyle(boldCenteredStyle))//show page number on the page footer
.highlightDetailEvenRows()
.setColumnTitleStyle(columnTitleStyle)
.setDataSource("SELECT f_name, l_name, email FROM suppliers", connection)
.show();
//export the report to a pdf file
report.toPdf(new FileOutputStream("d:/report.pdf"));
} catch (DRException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
报表生成正常,没有错误。我的想法是,当我关闭主 window 时,报告 window 不会变冷,这没关系,但每当我关闭报告 window 时,它就会关闭整个应用程序!!!可能以某种方式触发动态报告工具关闭功能以关闭整个应用程序。如何克服这个问题??
似乎如果我在 show 方法中传递参数 false 它不会关闭应用程序。
.show(false);
在我的 javafx 应用程序中,我使用 DynamicReports,它是免费和开源的 Java 报告工具。在我的按钮事件代码中,我调用了一种方法来显示报告:
report1.setOnAction(event -> {
getSupplierListReport();
}
);
这是方法:
public void getSupplierListReport()
{
report = DynamicReports.report();
try {
//show the report
report
.columns(
Columns.reportRowNumberColumn("No"),
Columns.column("First Name", "f_name", DataTypes.stringType()),
Columns.column("Last Name", "l_name", DataTypes.stringType()),
Columns.column("Email", "email", DataTypes.stringType())
)
.title(//title of the report
Components.text("Supplier List Report")
.setHorizontalAlignment(HorizontalAlignment.CENTER).setStyle(boldCenteredStyle))
.pageFooter(Components.pageXofY().setStyle(boldCenteredStyle))//show page number on the page footer
.highlightDetailEvenRows()
.setColumnTitleStyle(columnTitleStyle)
.setDataSource("SELECT f_name, l_name, email FROM suppliers", connection)
.show();
//export the report to a pdf file
report.toPdf(new FileOutputStream("d:/report.pdf"));
} catch (DRException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
报表生成正常,没有错误。我的想法是,当我关闭主 window 时,报告 window 不会变冷,这没关系,但每当我关闭报告 window 时,它就会关闭整个应用程序!!!可能以某种方式触发动态报告工具关闭功能以关闭整个应用程序。如何克服这个问题??
似乎如果我在 show 方法中传递参数 false 它不会关闭应用程序。
.show(false);