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
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Change color of ListField items.

Hello Guys Plz Help me,

I want to Change color of  ListField Content.

How can i achieve this. Plz Help me, It's urgent.

Please use plain text.
Developer
simon_hain
Posts: 16,216
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Change color of ListField items.

graphics.setcolor

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
BB-Dude
Posts: 516
Registered: ‎07-23-2010
My Device: 9900

Re: Change color of ListField items.

Read this post:

 

http://tiny.cc/wo4tj

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

Re: Change color of ListField items.

Hi BB-Dude,

 

I got this from that Link;

 

But I am not understand that. How can i implement this. Plz Tell me. Thanks.

 public void drawListRow(ListField list, Graphics g, int index, int y, int w) 
{
if(list.getSelectedIndex() == index)
{
g.setColor(0x0000FF);
g.fillRect(0,(index*rowHight),rowWidth,rowHeight);
g.setColor(0x000000);
}
g.drawText("Text", 0, y, 0, w);
}
Please use plain text.
Developer
BB-Dude
Posts: 516
Registered: ‎07-23-2010
My Device: 9900

Re: Change color of ListField items.

Look at the following:

net.rim.device.api.ui.component.ListFieldCallBack

net.rim.device.api.ui.component.ListField

 

Your class should extend ListField and implement ListFieldCallBack

 

That should get you started.

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

Re: Change color of ListField items.

I am Using This,

I want to ask Only that Where and when I can call that Method drawListField.

Please use plain text.
Developer
BB-Dude
Posts: 516
Registered: ‎07-23-2010
My Device: 9900

Re: Change color of ListField items.

You do not need to call the drawListRow method. It is handled automatically.

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

Re: Change color of ListField items.

Ok. I am trying.

Thanks.

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,690
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Change color of ListField items.

This sample should help out.

 

Create a colour ListField

http://supportforums.blackberry.com/t5/Java-Development/Create-a-colour-ListField/ta-p/442955

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.