【问题标题】:How add jasper report viewer to a scrollpanel?如何将碧玉报告查看器添加到滚动面板?
【发布时间】:2013-11-25 16:00:25
【问题描述】:

这是我的代码..

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

    }   

【问题讨论】:

    标签: java swing netbeans


    【解决方案1】:

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

    jScrollPane can't add component

    this

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-30
      相关资源
      最近更新 更多