Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help writing Jasper report by hand with Java

 
Anne M Crace
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is anybody experienced with Jasper reports? I have a Swing GUI with a JTable and the user can choose the columns they want displayed at runtime. I am passing a DefaultTableModel through my application. I was able to get my report to work when I generated it in iReport with COLUMN_0, COLUMN_1, etc. but it would only display when all the columns were selected. I believe I need to generate the .jasper file manually with JasperReports API. I am able to generate the .jasper file and decompile it with iReport but the first problem I am having is all of the fields I am passing in aren't being generated. The other problem is I need to associate the JRDesignTextFields with the Fields. I'm sure I'm going to have other problems (the commented out lines near the bottom blow up). Anyhow, any help would be appreciated. I am using version 4.7.1 of iReport and Jasper Reports so I don't have quite the latest version. Here is my Java code:
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens when you execute the commented out lines? Can you post the entire stack trace of any exception?
 
Anne M Crace
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the stack trace. The last line starts my Swing code so that and anything after is probably irrelevant.
java.lang.ClassCastException: net.sf.jasperreports.engine.fill.JRFillFrame cannot be cast to net.sf.jasperreports.engine.fill.JRFillElementGroup
at net.sf.jasperreports.engine.fill.JRFillElement.<init>(JRFillElement.java:166)
at net.sf.jasperreports.engine.fill.JRFillTextElement.<init>(JRFillTextElement.java:99)
at net.sf.jasperreports.engine.fill.JRFillStaticText.<init>(JRFillStaticText.java:50)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.visitStaticText(JRFillObjectFactory.java:636)
at net.sf.jasperreports.engine.base.JRBaseStaticText.visit(JRBaseStaticText.java:95)
at net.sf.jasperreports.engine.JRAbstractObjectFactory.getVisitResult(JRAbstractObjectFactory.java:89)
at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:82)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:88)
at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:88)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:496)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:430)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:82)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:569)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:915)
at DTP_utils.PrintRoster.testPrint(PrintRoster.java:162)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic