Preparations

Before programming with the Result Viewer Bean, you need to import the classes of the Result Viewer Bean by adding the following import statements to the beginning of your program. The first import statement is added to import the bean class:

import jet.bean.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

Then, you need to create an instance.

To run with the JReport Result Viewer Bean, you should first create an instance of it. The constructor of the Result Viewer Bean has no parameter. After the object has been created, you should then set the report name and temp path (if not set, the current path will be used).

bean = new JRResultViewer();
bean.setShowInfoLevel(bean.vDebug | bean.vError);
bean.setReportName("c:\\test\\customerlist.rst");
bean.runReport("yes");

With the JReport Result Viewer Bean object, you can show the report result and export it to other formats or to printer. You do not need to create a bean for each report. The Result Viewer Bean provides many useful methods.