Jump to content
JasperReports Library 7.0 is now available ×

another simple question (images)


2005 IR Help

Recommended Posts

By: Brandon Plamondon - bplamondon

another simple question (images)

2004-06-03 11:21

I have a problem with the following... what is the correct form to enter for an address cause I have tried a lot of things and I cant get the image to show up. at first I just had it pointing to test.JPG like it shows which is in the same folder as the source files... thanks in advance for any help

 

JRDesignImage what = new JRDesignImage();

what.setX(100);

what.setY(100);

what.setScaleImage(JRImage.SCALE_IMAGE_RETAIN_SHAPE);

expression = new JRDesignExpression();

expression.setValueClass(java.lang.String.class);

expression.setText(""test.JPG"");

what.setExpression(expression);

band.addElement(what);

 

 

 

 

 

 

By: Lucian Comanescu - lucicom

RE: another simple question (images)

2004-06-03 22:53

Hi!

 

the expression.setText is ok ... but you need to set the rigth path to the image. Probably the source files are compiled in some folder like "classes" or "bin", so you have to copy also your image there.

Or just put it in a folder "images/test.jpg" (relative to your start directory) and use this expression. Or place it somewhere in the classpath:

 

[manual]When the image expression returns a java.lang.String value, the engine will try to see

whether the value represents an URL from which to load the image. If it is not a valid URL

representation, it will try to locate a file on disk and load the image from it, assuming that

the value represents a file name. If no file is found, it will finally assume that the string

value represents the location of a classpath resource and will try to load the image from

there. Only if all those fail, an exception will be thrown.

 

Lucian

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...