(DIYA) Call Girls Sinhagad Road ( 7001035870 ) HI-Fi Pune Escorts Service
Clases jasper report
1. CLASE PARA VER LOS REPORTES Y EXPORTARLOS A FORMATO PDF
package principal;
import java.sql.Connection;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JRException;
public abstract class AbstractJasperReports
{
private static JasperReport report;
private static JasperPrint reportFilled;
private static JasperViewer viewer;
public static void createReport( Connection conn, String
path )
{
try {
report = (JasperReport)
JRLoader.loadObjectFromFile( path );
reportFilled =
JasperFillManager.fillReport( report, null, conn );
}
catch( JRException ex ) {
System.out.println("NO CARGO EL REPORTE");
ex.printStackTrace();
}
}
public static void showViewer()
{
viewer = new JasperViewer( reportFilled );
viewer.setVisible( true );
}
public static void exportToPDF( String destination )
{
try {
2. JasperExportManager.exportReportToPdfFile( reportFilled,
destination );
}
catch( JRException ex ) {
ex.printStackTrace();
}
}
}
CLASE PRINCIPAL CON EL USO DE UN HILO (THREAD)
package principal;
import java.awt.EventQueue;
public class Main {
public static void main(String[] args) {
openReportFrame();
}
private static void openReportFrame()
{
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Form1 frame = new Form1();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
LO DEMÄS ESTÁ EXPLICADO EN EL VIDEO