Java - JasperReports:JasperViewer 不显示报告

问题描述 投票:0回答:0

我在 jdk -7u80 中运行 iReport 5.6,我在使用 JasperViewer 时遇到了问题。我的应用程序运行良好,甚至 JasperPrint 功能也运行良好,因为它通过输入错误的目录来捕获错误。

但是,JasperViewer.viewReport(print);没有显示我的报告。有人可以帮我解决这种情况吗?

我还使用 iReport 工具测试了我的报告,并且工作正常。所以再一次,帮助!

 private void menRelCliActionPerformed(java.awt.event.ActionEvent evt) {                                          
    // Generating a customer report
    int confirma = JOptionPane.showConfirmDialog(null, "Confirm to print this report?", "Attention", JOptionPane.YES_NO_OPTION);
    if (confirma == JOptionPane.YES_OPTION) {
        //printing report with JasperReports framework
        try {
            //using the JasperPrint class to prepare a report for printing
            JasperPrint print = JasperFillManager.fillReport("C:/reports/clientes.jasper", null, conexao);

            //it is supposed to displays the report through the JasperViewer class BUT DON'T WORK!
            JasperViewer.viewReport(print, false);
                         
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
    };
} 
java jasper-reports
© www.soinside.com 2019 - 2024. All rights reserved.