Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Need help writing Jasper report by hand with Java

 
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:
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • 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)
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!