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
Developer
Posts: 147
Registered: ‎09-10-2008
My Device: Not Specified

Setting color text in the ListField ?

How to set the custom color for each row in the ListField. how to obtain the fixed font / fixed screen size in all device.

how to set the Text Color of the Each Row in the List Field .  I dont want the demo of the colored background listbox .

Tellme how to achive the above give me the alternate ways if not possible give the ur own suggestion. 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Setting color text in the ListField ?

You can override the paint() method in any field and set the foreground (text) color.

 

Then you will either draw the text yourself or call super().

 

See the API docs for Field (paint(), drawFocus()) and Graphics.

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Setting color text in the ListField ?

[ Edited ]

Not sure what you mean by your questions but here are some thoughts:

 

"How to set the custom color for each row" - what in each row is colored.  It seems that you don't want the background colored so I presume you mean you want the text colored, in which case it is just graphics.setColor(...);

 

"how to obtain the fixed font " - there is not, as far as I know, a non proportional font on the device.  To set the font, it is graphics.setFont(...)

 

"fixed screen size in all device" - isn't this a contradiction?  How can you have a fixed screen size when devices have differently sized screens?  Sorry I don't understand this.  Do you think it is possible to have something look the same on the Bold's 320 * 480 and the Curve's 240 * 320 and the Pearl's 240 * 320?

 

"set the Text Color " - is this the same as above "custom color for each row"?

 

"Tellme how to achive the above give me the alternate ways if not possible give the ur own suggestion" 

In my opinion, the question you ask is too open-ended to get a good response.  It is like asking "tell me how to get to Mumbai and give me alternate ways" - you can't answer that question without finding out where you are coming from.  So my suggestion to you is to research what you want and try some alternatives, look at the samples to see what they do, then tell us what you have tried and ask for help.  Yes, it is more work for you, but you will understand the answers that you are given, and perhaps you may learn enough to contribute to this forum.  After all, this forum would not work if we just took ideas and didn't contribute.

 

Message Edited by peter_strange on 10-18-2008 10:45 AM