这是我的代码..
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
// TODO add your handling code here:
Connection con= DB_Connection.getConnection();
String REPORT="C:\\Users\\Harshana\\Documents\\NetBeansProjects\\Remedco\\src\\Reports\\report1.jrxml";
JasperReport jr= JasperCompileManager.compileReport(REPORT);
JasperPrint jp= JasperFillManager.fillReport(jr, null,con);
JasperViewer viewer=new JasperViewer(jp,false);
Container container = viewer.getContentPane();
jScrolReprt.add(container);
jScrolReprt.revalidate();
jScrolReprt.repaint();
} catch (ClassNotFoundException ex) {
Logger.getLogger(RegisterPatient.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
Logger.getLogger(RegisterPatient.class.getName()).log(Level.SEVERE, null, ex);
} catch (JRException ex) {
Logger.getLogger(RegisterPatient.class.getName()).log(Level.SEVERE, null, ex);
}
}