Jump to content
Changes to the Jaspersoft community edition download ×

Image in JRDesignParameter


Recommended Posts

By: adf ads dsf - pkw

Image in JRDesignParameter

2004-02-04 05:59



I have a little problem. I defined report with parameter which class is java.awt.Image. This image is read from jar file. When I run report for the first time I always get exception:




Width (-1) and height (-1) cannot be <= 0


(no data is retrieved??)

but if my application is still running and I execute the same report for the second time I can see the image!

Can anybody help me?


Best regards




By: Paulo Soares - psoares33

RE: Image in JRDesignParameter

2004-02-04 08:39

You must actually load the image. This was extracted from iText's PdfGraphics2D:


private MediaTracker mediaTracker;


private synchronized void waitForImage(java.awt.Image image) {

if (mediaTracker == null)

mediaTracker = new MediaTracker(new PdfGraphics2D.fakeComponent());

mediaTracker.addImage(image, 0);

try {



catch (InterruptedException e) {

// empty on purpose






static private class fakeComponent extends Component {



Best Regards,

Paulo Soares



By: adf ads dsf - pkw

RE: Image in JRDesignParameter

2004-02-05 10:02

It works!

Thank You:)


Best Regards,


Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...