private void btnCetakActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_btnCetakActionPerformed
// TODO add your handling code here:
try{
HashMap data=new HashMap();
String buatLaporan=("./src/POSWorkshop/laporan/LapDataPembelian.jasper");
JasperPrint cetak_laporan = JasperFillManager.fillReport(buatLaporan, data, conn);
JasperViewer LaporanData=new JasperViewer(cetak_laporan, false);
LaporanData.setTitle("Laporan Data Pembelian");
LaporanData.setVisible(true);
}catch(Exception e){
javax.swing.JOptionPane.showMessageDialog(rootPane, "Gagal Menampilkan Laporan");
}
}
Silahkan ubah kodenya sperti di bawah
try{
HashMap data=new HashMap();
URL img = this.getClass().getClassLoader().getResource("persediaanbahan/gambar/logo.png");
//File image = new
File("persediaanbahan/gambar/logo.png");
data.put("logo",img);
data.put("id_proyek",cbValue);
InputStream buatLaporan = ClassLoader.getSystemResourceAsStream("persediaanbahan/laporan/LapPemPro.jasper");
JasperPrint cetak_laporan = JasperFillManager.fillReport(buatLaporan, data, conn);
JasperViewer LaporanData=new JasperViewer(cetak_laporan, false);
LaporanData.setTitle("Laporan Data Pengeluaran Proyek");
LaporanData.setVisible(true);
}catch(Exception e){
javax.swing.JOptionPane.showMessageDialog(rootPane,e);
}