Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
rabiyabasri
Posts: 49
Registered: ‎12-21-2010
My Device: 9000 Bold Device
My Carrier: software developer

Under Line

hellooooo

 

i have a problem that i can able to under line hole string  for example

 

Farmers Insurance Water Craft University of Farmers

 

using this code

labelfield.setFont(getFont().derive(Font.UNDERLINED));

 

but i want under line a perticular word or sentents for example

 

Farmers Insurance Water Craft University of Farmers.

 

it is possible in blackberry , if it is possible then please give me a code for how to do this...

 

thank you

Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: Under Line

You have to Merge three LabelField through the "HorizontalFieldManager"

Like first LabelField Contains the Farmers Insurance Water Craft

Second LabelField Contains the university

 Third LabelField Contains the of Farmers.

------------------------------------------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.

Please use plain text.
Developer
vivart
Posts: 147
Registered: ‎08-27-2010
My Device: 9800
My Carrier: airtel

Re: Under Line

You can also try this

 

 

String data = "Farmers Insurance Water Craft University of Farmers";  
		int index = data.indexOf("University");
        int offsets[] ={0,index,index+10,data.length()};  
        Font[] fonts = new Font[] { Font.getDefault(),Font.getDefault().derive(Font.UNDERLINED)};  

        byte attributes[] = {0,1,0};  

        add(new RichTextField(data, offsets, attributes, fonts,  
                        0));  

 

 

Please use plain text.
Contributor
rabiyabasri
Posts: 49
Registered: ‎12-21-2010
My Device: 9000 Bold Device
My Carrier: software developer

Re: Under Line

HI!!!

 

This is usefull for me but after under line is should navigate to next page.

for example, .html file, .java file ...................

 

it is possible or not please help me for this solution...

 

 

thanks for Your help

Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: Under Line

what you did with your code.

Show here.

------------------------------------------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.

Please use plain text.
Contributor
wfilla
Posts: 41
Registered: ‎01-27-2011
My Device: Not Specified

Re: Under Line

I also need to change text in the middle of a sentence. Could you show how you would write the code to merge the LabelFields through the HorizontalFieldManager?

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Under Line

 


wfilla wrote:

I also need to change text in the middle of a sentence. Could you show how you would write the code to merge the LabelFields through the HorizontalFieldManager?


Just add them one by one to a HorizontalFieldManager then add that manager to your screen.

You can have different fonts for different fields (such as derived UNDERLINE font).

You can even make some of them focusable and override navigationClick in those fields with the methods that (for example) push other Screens onto the stack.

 

Another possibility would be to use ActiveRichTextField - it can move focus within itself and do all kinds of sophisticated things. I would suggest you start with something simpler, though, then gradually make your way into the higher-level stuff.

 

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
Contributor
wfilla
Posts: 41
Registered: ‎01-27-2011
My Device: Not Specified

Re: Under Line

Thanks,  I'll give that it a try. Anytime anyone wants to give a tutorial on how to do the advanced stuff with ActiveRichTextField, I would definately be interested.

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Under Line

This might be useful:

http://supportforums.blackberry.com/t5/Java-Development/Format-text-in-a-RichTextField/ta-p/445038

 

Note that the problem with having multiple LabelFields in a HFM is that they will all appear on the same row. So wrapping will look more than a little peculiar I expect. 

Please use plain text.
Contributor
wfilla
Posts: 41
Registered: ‎01-27-2011
My Device: Not Specified

Re: Under Line

This link is great! Thank you! And thanks for the heads up on the LabelFields.

Please use plain text.