0

这是我的代码..

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);
        }

    }   
4

1 回答 1

1

您应该将它直接添加到 JScrollPane 的视口中

jScrollPane 无法添加组件

这个

于 2013-11-13T08:25:51.557 回答