View Full Version : 100% question

07-07-2002, 09:25 AM
Hi - I see that the new demo xml files use width=100% for page headings etc.
How do you set this if you're creating elements dynamically within your program ?

pageHeading1 = itmFactory.createLabelElement
("Report Title",(new Rectangle2D.Double(0,5,0,10)),null,Element.CENTER,serif,labelText);

This used to align centrally if x1=x2=0.

Thanks - Shakes

07-07-2002, 03:30 PM

use negative values for the dimensions: -100 is converted to 100%, -50 is 50% and so on. This works for all elements, except the line-element. This element needs a change for this feature to work, and is marked as task.

When you set the position of an element to 50% the element is printed at the given relative position, the box starts at the half of the width and is printed "width" pixels. So there is no way of centering an element, all you can do is to define the elements origin and extends.

The text alignment defines how the contained text is placed inside the elements boundries and has nothing to do with the elements placement in the band.

It is the best, to create a Rectangle-Element to visualize the boundries of the formed text element.

Have more fun,
said Thomas