Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Box and the text inside (Read 3543 times)
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Box and the text inside
Jul 12th, 2007 at 2:54am
Print Post  
Hi,

I have two questions in this post.

1. When names grow beyond the displayable size, the name disappears. Can this be changed to show part of the name?

2. Given a String to be displayed as the text of a box, can the width the string would need be determined? This way, we can resize the box to fit the string.

Thanks,
Praveen
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Box and the text inside
Reply #1 - Jul 12th, 2007 at 5:08am
Print Post  
Hi,

1. Currently that's not possible.

2. You could call the Box.resizeToFitText method.

Stoyan
  
Back to top
 
IP Logged
 
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: Box and the text inside
Reply #2 - Jul 15th, 2007 at 8:58am
Print Post  
Hi,

For the first question,

I have the source code of your project. Can you suggest me any way I can modify the source to make the text wrap inside the box. This can save me some time finding out on my own. Smiley

Thanks,
Praveen
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Box and the text inside
Reply #3 - Jul 16th, 2007 at 6:11am
Print Post  
Hi,

You must modify TextLayout.java to prevent the text layout algorithm from breaking the lines of text into words (where lines are the substrings delimited by new-line characters). I.e. create a single Word object for each line. Then before drawing the text in the Box.renderText method set a clipping region that matches the box shape, so that text lines are clipped when they are larger than the available space.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint