Java Reference
In-Depth Information
JasperPrint jasperPrint = generateReport();
JasperViewer jasperViewer = new JasperViewer(jasperPrint);
jasperViewer.setVisible(true);
}
private JasperPrint generateReport()
{
JasperPrint jasperPrint = null;
try
{
jasperPrint = JasperFillManager.fillReport(
"reports/AircraftReport.jasper", new HashMap(),
new JRTableModelDataSource(tableModel));
}
catch (JRException e)
{
e.printStackTrace();
}
return jasperPrint;
}
private class ReportGenerator implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
displayReport();
}
}
/**
* @param args
*/
public static void main(String[] args)
{
new TableModelReport();
}
}
This example, when executed, will display a window on the screen displaying a table
containing the Aircraft Data we have been using for most of the examples in this
chapter, along with a Generate Report button at the bottom.
 
Search WWH ::




Custom Search