Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Solution for working with modal window and JasperReport / iReport. / Solução para se trabalhar com janela modal e JasperReport/iReport.
public void gerarReport(String filePath, List list) throws Exception {
JDialog dialogReport = new JDialog(new javax.swing.JFrame(), "TITLE REPORT", true);
dialogReport.setSize(1000, 700);
dialogReport.setLocationRelativeTo(null);
InputStream fileReport = getClass().getResourceAsStream(filePath);
Map params = new HashMap();
JRBeanCollectionDataSource dataList = new JRBeanCollectionDataSource(list);
JasperPrint print = JasperFillManager.fillReport(fileReport, params, dataList);
JasperViewer windowJasper = new JasperViewer(print, true);
dialogReport.getContentPane().add(windowJasper.getContentPane());
if ( print.getPages().size() > 0 )
dialogReport.setVisible(true);
else
throw new Exception("No Pages!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.