title: When a JasperViewer appear and I close it, the main frame/parent also closed
body: <p>When a <code>JasperViewer</code> appear and I close it, the main frame / parent also closed. How to prevent this?</p>
  
  <p>This is my code..</p>
  
  <pre><code> 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);
          }
  </code></pre>