当一个JasperViewer
出现并且我关闭它时,主框架/父级也关闭了。如何防止这种情况?
这是我的代码..
private void cmdprintidMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
try {
JasperDesign jasperDesign = JRXmlLoader.load("report12.jrxml");
String sql = "select * from db1 where Company LIKE '" + txtcompany.getText() + "%'";
JRDesignQuery newQuery = new JRDesignQuery();
newQuery.setText(sql);
jasperDesign.setQuery(newQuery);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, conn);
JasperViewer.viewReport(jasperPrint);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}