iReport Tutorial: Call iReport from Java Application
Reports designed by iReport can be called/ viewed/ embedded/ included in Java application in various ways. A sample coding is given below. Before compiling and running this code the jar files located in the lib folder of iReport installation folder must be included in the classpath.The sample code shown below uses JFrame to view the report. You can view the report in JInternalFrame or JPanel very easily just by inheriting JInternalFrame or JPanel respectively instead of extending JFrame.
The class below has two constructors. The default constructor can be used for reports without any parameter. The second one can be used for parameterized report. The parameters should be stored in a HashMap object as the key and value pairs. The key will be the name of the parameter in the report and the value will be the variable where the input is stored.