Results 1 to 4 of 4
  1. #1
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default iReport netbeans tutorial

    Hi, I learned that iReport is the tool to create report in java, I am trying to make a report now using the said tool, I have searched in google using several keywords with no luck. Can someone give a link to a tutorial on how to create report and load it in java for a beginner in netbeans.

    Any help is greatly appreciated

    Thanks,
    geje

  2. #2
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default

    Hi was able to create iReport and code it in java but iReport does not show. I dont think the message from output window in netbeans is an error message but here are some message from output window.

    Here is what I have tried to load/show the report.

    Java Code:
    import java.sql.*;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.swing.JRViewer;
    
    public class ReportView
    {
        public ReportView()
        {
          showReport();
        }
    
        void showReport()
        {   try
            {
                String url = "jdbc:mysql://anotherPC:3306/bibo";
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                Connection conn = DriverManager.getConnection(url, "username", "password");
                JasperReport report = JasperCompileManager.compileReport("Z:\\folder1\\src\\projfolder1\\report1.jrxml");
                JasperPrint print = JasperFillManager.fillReport(report,null, conn);
                JRViewer viewer = new JRViewer(print);
                viewer.setOpaque(true);
                viewer.setVisible(true);
            }
            catch(Exception ex)
            {ex.printStackTrace();}
        }
    }
    I just pick some because it is too long, in case you want to see the whole message please see the .txt file that I uploaded.
    from output window in java.
    Jul 22, 2010 11:15:37 AM org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from URL [jar:file:/Z:/POMS/projPOMS/lib/JasperReports/jasperreports-chart-themes-3.5.2.jar!/net/sf/jasperreports/chartthemes/spring/beans/chartThemesBeans.xml]
    Jul 22, 2010 11:15:37 AM org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from URL [jar:file:/Z:/POMS/projPOMS/lib/JasperReports/jasperreports-chart-themes-3.5.2.jar!/net/sf/jasperreports/chartthemes/spring/beans/defaultChartPropertiesBean.xml]
    Jul 22, 2010 11:15:37 AM org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from URL [jar:file:/Z:/POMS/projPOMS/lib/JasperReports/jasperreports-chart-themes-3.5.2.jar!/net/sf/jasperreports/chartthemes/spring/beans/chartConstantsBean.xml]
    Jul 22, 2010 11:15:37 AM org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from URL [jar:file:/Z:/POMS/projPOMS/lib/JasperReports/jasperreports-chart-themes-3.5.2.jar!/net/sf/jasperreports/chartthemes/spring/beans/eyeCandySixtiesChartPropertiesBean.xml]
    Jul 22, 2010 11:15:37 AM org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from URL [jar:file:/Z:/POMS/projPOMS/lib/JasperReports/jasperreports-chart-themes-3.5.2.jar!/net/sf/jasperreports/chartthemes/spring/beans/chartConstantsBean.xml]
    Jul 22, 2010 11:15:37 AM org.springframework.beans.factory.support.DefaultL istableBeanFactory registerBeanDefinition
    INFO: Overriding bean definition for bean 'isTrue': replacing [Generic bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
    Jul 22, 2010 11:15:37 AM org.springframework.beans.factory.support.DefaultL istableBeanFactory registerBeanDefinition
    INFO: Overriding bean definition for bean 'isFalse': replacing [Generic bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
    Jul 22, 2010 11:15:37 AM org.springframework.beans.factory.support.DefaultL istableBeanFactory registerBeanDefinition
    INFO: Overriding bean definition for bean 'fontPlainStyle': replacing [Generic bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
    Jul 22, 2010 11:15:37 AM org.springframework.beans.factory.support.DefaultL istableBeanFactory registerBeanDefinition
    INFO: Overriding bean definition for bean 'fontBoldStyle': replacing [Generic bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.beans.factory.config.FieldRetr ievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
    ...
    Thanks,
    geje
    Last edited by mine0926; 07-22-2010 at 04:52 AM.

  3. #3
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    4

    Default

    Everything is working now. I just extend a JFrame in my class and add a JScrollPane.
    Java Code:
     public class ReportView extends JFrame
     {  ...
         void showReport()
        {   try
            {   
                
                //database connection here
                JasperReport report = JasperCompileManager.compileReport("Z:\\folder1\\src\\projfolder1\\report1.jrxml");
                JasperPrint print = JasperFillManager.fillReport(report,null, conn);
                JRViewer viewer = new JRViewer(print);
                viewer.setOpaque(true);
                viewer.setVisible(true);
                [b]//add a scrollpane
                scrollview.add(viewer);
                scrollview.setViewportView(viewer);[/b]
                pack();
            }
            catch(Exception ex)
            {
                System.out.println("CAUSE: " + ex.getCause());
                System.out.println("MESSAGE" + ex.getMessage());
                System.out.println("LOCAL MESSAGE" + ex.getLocalizedMessage());
                ex.printStackTrace();
            }
        }
     }

  4. #4
    athan is offline Member
    Join Date
    Aug 2011
    Posts
    1
    Rep Power
    0

    Default Begging your solution

    I had the same problem with you but your solution did not work in me, please provide me your exact answer or code in that particular class.

    Please please.

    jonathancabrera85@yahoo.com is my email add

    Thanks

Similar Threads

  1. NetBeans Tutorial
    By SiR.Warlock in forum NetBeans
    Replies: 9
    Last Post: 06-30-2010, 01:03 PM
  2. iReport
    By Freddie in forum Advanced Java
    Replies: 6
    Last Post: 04-20-2010, 06:25 PM
  3. About iReport
    By HotEvilGirl in forum New To Java
    Replies: 1
    Last Post: 05-06-2009, 01:07 PM
  4. jsp and ireport
    By sbuggle in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-25-2008, 09:25 AM
  5. Jasper Report + iReport + NetBeans 4
    By Ed in forum NetBeans
    Replies: 2
    Last Post: 07-02-2007, 07:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •