Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Jasper Report Display In JdesktopPane

 
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);
 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • 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
 
Ranch Hand
Posts: 178
2
Netbeans IDE MySQL Database Java
  • 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.
 
permaculture is giving a gift to your future self. After reading this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic