This tutorial entitled “How to create a report in Java using iReport Designer” will teach you on how to create or add a new report file inside your netbeans package. This tutorial also discuss on how to setup your database connection through your report designer.
A java report file has an extension “.jrxml” use in designing your report. After compiling your .jrxml file, it will create a new file with a new extension “.jasper”. The jasper file is use to display your report within your java program while it is running.
How to create a report in Java using iReport Designer Steps
Right-click your source package, select New, and Select Empty Report. You can also select Report Wizard to create your report using wizard.
Input the file name of your report and click finish button. In my case, I used “newReport” as my filename.
In the Netbeans tools, click the report datasource. The connections & datasources window will display, click the New and fill all the database information. In my example I used MySQL database.
Be sure to select your new created data source before designing your report.
In your report designer, click the add query. Input your query and click the ok button.
In the upper left of the netbeans window, click the Report Inspector and find the fields option. All the attributes you input in the query will display in the field option.
Highlight all the attributes displayed in the field and drag through your report designer under Detail1.
Design your report just look like the image below. All elements and object of the report is located in the Tool palette.
Click the preview button and the output should look like the image below.
About How To Create A Report In Netbeans Using iReport Designer In Java
|Project Name:||How To Create A Report In Netbeans Using iReport Designer|
Remember that this tutorial will teach you on how to create a report inside your Netbeans. In my next tutorial, I will discuss on how to display the report in your Java program. If you have questions and suggestions regarding on this topic, feel free to contact us.
Related Articles You May Like: