ලේසියෙන්ම හොයාගන්න මෙතනින්

ඉක්මණින්ම ST II Assignment ගොඩ දාගන්නත් එපැයිනේ - Part 8

ඉක්මනින්ම iReport වැඩෙත් ඉවර කරලා දාමු.
iReport වලින් report එකක් design කරලා, parameters සෙට් කරලා,
NetBeans වල ඉදන් ඒ iReport file එකට, load කරන හැටි.


සැ.යු. - Interface Design එක ගැන සලකා නැත. මුලිකම පෙනුම පමණි.
එක් එක් coding කුමක් සඳහාද යන්න තේරුම් ගැනීම ඔබ සතුය.




Quick - Generate Report using iReports
Download File Size - 18.19MB
After Extract File - 1800MB
Duration - 26min


http://www.mediafire.com/?jw515skb58h58c1


///////////////////////////reportGen.java///////////////////////
public class reportGen extends JFrame{
    public reportGen(String filename) {
        try {
            Connection con = DB_Connect.getConnection();
            JasperPrint print = JasperFillManager.fillReport(filename,null,con);
            JRViewer jr = new JRViewer(print);
            Container contain = getContentPane();
            contain.add(jr);
            setVisible(true);
            setBounds(10, 10, 800, 660);
        }catch (JRException e){
            JOptionPane.showMessageDialog(this, "JRE Error");
        } catch (SQLException ex) {
            Logger.getLogger(reportGen.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(reportGen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
   
    public reportGen(String filename,HashMap hash) {
        try {
            Connection con = DB_Connect.getConnection();
            JasperPrint print = JasperFillManager.fillReport(filename,hash,con);
            JRViewer jr = new JRViewer(print);
            Container contain = getContentPane();
            contain.add(jr);
            setVisible(true);
            setBounds(10, 10, 800, 660);
        }catch (JRException e){
            JOptionPane.showMessageDialog(this, "JRE Error");
        } catch (SQLException ex) {
            Logger.getLogger(reportGen.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(reportGen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
   
}



//////////////////////////GenerateReport.java////////////////////////////////
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
        String from_date = jDateChooser1.getDate().toString();
        String to_date = jDateChooser2.getDate().toString();
        HashMap hash = new HashMap();
        hash.put("from_date", from_date);  //here inside double quote, the name given is, name of the parameter
        hash.put("to_date", to_date);
       
        reportGen rep = new reportGen("./src/iReport/CustomReport.jasper", hash);
    }

1 comment :

  1. thaxx lot machan..
    me blog eka nothibenna st project eka karanna wenna.. specially ireports.
    hemadema pehediliwa thibuna machan.. thanx machan.. :)

    -hasarangaprasad

    ReplyDelete