PDA

View Full Version : SIZE_FIT_TEXT


ayman
04-01-2008, 07:07 AM
I have the following code
GlobeAnnotation ga = new GlobeAnnotation(annotationString,positio n,Font.decode("Arial-BOLD-11"));
ga.getAttributes().setAdjustWidthToText( Annotation.SIZE_FIT_TEXT);

The annotation divide the string into two or three lines, and doesn't expand the width to fit the test.

patmurris
04-01-2008, 02:26 PM
You have to set ga.getAttributes().setSize(new Dimension(xxx, 0)); - the xxx being how wide an annotation can grow before it wraps the text to another line. The FIT_TEXT option tells whether the annotation will use the exact width given in size or shrink a bit to fit exactly the text inside - the rendered text may not use the whole width.

Note that the height given in the setSize() can be zero - the default. It means the annotation will fit the rendered text length.