• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jasper Report Display In JdesktopPane

 
Giruba Karan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to java. I tried to display jasper Report in Jdesktoppane but report Does not display in jdesktoppane.I cant get any error or Exception while run the program how to slove this problem..


JasperDesign jd=JRXmlLoader.load("F:\\Net Beans\\Project\\Chit\\src\\Report\\report1.jrxml");
JasperReport jr=JasperCompileManager.compileReport(jd);
JasperPrint jp=JasperFillManager.fillReport(jr, null,chit1.conn);
JRViewer viewer = new JRViewer(jp);
jDesktopPane.add(viewer);
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

I noted that Jasper's JRViewer extends swing's JPanel so the viewer is a (swing) component. So adding the JRViewer to the JDesktopPane should be valid.

Does the report itself compile? Does the DB connection chit1.conn null (for the JasperPrint)?

I noticed your report path has a space in it, this might be the problem.
 
Giruba Karan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the step to display jasper Report

Create Jinternal Frame add below code and then add to JdesktopPane
here is the code
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you call the Report() method after the JInternalFrame has shown. (That means after calling setVisible(true))
If you have done that you have to re-validate your JInternalFrame. To do that type revalidate() after adding the viewer.

If you don't know why revalidate() should be called, search google or read API.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!