1

I have created jasperReport(v6.0) with Eclipse-Luna plugin. When I view the report, it will open new window with report. I want to display this report inside the same Java Swing window (JDK 1.8).

Below code will open JasperViewer in new window

String reportPath = "reports/report.jrxml";
try {
    JasperReport jr = JasperCompileManager.compileReport(reportPath);
    JasperPrint jp = JasperFillManager.fillReport(jr, null, conn);
    JasperViewer.viewReport(jp);
    conn.close();
} catch (Exception e1) {
    JOptionPane.showMessageDialog(null, e1.getMessage());
}
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Supun Silva
  • 580
  • 5
  • 21

0 Answers0