how to add this view at jpanel1

0

 

i used netbens i connect jasper report i have 2pages  i already made 2 design also but i can view one design how to view two page 

 

public void loadreport1(){
          
          SimpleDateFormat date1 = new SimpleDateFormat("MMM d, yyyy");
        String fdate = date1.format(jDateChooser1.getDate());
              
        
        
            HashMap a = new HashMap();
            a.put("inemp", jTextField1.getText());
            a.put("idate",fdate);
             a.put("thy", jTextField2.getText());
              a.put("levno", jTextField3.getText()); 
           try {
              jPanel1.removeAll();
            jPanel1.repaint();
            jPanel1.revalidate();
          
           JasperDesign jdesign = JRXmlLoader.load("C:\\Users\\Futuremind\\Documents\\NetBeansProjects\\EmployeeManagementSystem\\src\\EmployeeManagement\\report5.jrxml");
           JasperDesign jdesign1 = JRXmlLoader.load("C:\\Users\\Futuremind\\Documents\\NetBeansProjects\\EmployeeManagementSystem\\src\\EmployeeManagement\\report6.jrxml");
           JasperReport jreport = JasperCompileManager.compileReport(jdesign);
         JasperReport jreport1 = JasperCompileManager.compileReport(jdesign1);
            JasperPrint  jprint  = JasperFillManager.fillReport(jreport, a,conn);
            JasperPrint  jprint1  = JasperFillManager.fillReport(jreport1,a,conn);
          

           JRPrintPage page1 = jprint.getPages().get(0);
List<JRPrintPage> pages2 = jprint1.getPages();
for (JRPrintPage page : pages2) {
   List<JRPrintElement> elements = page.getElements();
   for (JRPrintElement element : elements) {
     page1.addElement(element);
   }
}
          
            JRViewer v = new JRViewer();
            jPanel1.setLayout(new BorderLayout());
            jPanel1.add(element);
            

cv5079's picture
3
Joined: Jan 9 2021 - 3:38am
Last seen: 3 months 3 weeks ago

0 Answers:

No answers yet
Feedback