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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Trusted Contributor
Posts: 182
Registered: ‎09-22-2011
My Device: 9700
My Carrier: airtel
Accepted Solution

Customizing default blue color of listfield

I am trying to customize the default blue color of the list field.Its only coming for the first row but not for other rows.Please help.

 

 

int[] cols = new int[]{0x7FBEFF, 0x7FBEFF, 0x00FFFFFF, 0x00FFFFFF };
int[] xInds = new int[]{0, Display.getWidth(), Display.getWidth(), 0};
int[] yInds = new int[]{0, 0, listnew.getRowHeight(),listnew.getRowHeight()};

if(listnew.getSelectedIndex() == index)
{
g.drawShadedFilledPath(xInds, yInds,null, cols, null);
g.setColor(Color.BLACK);
}
listnew.invalidate(index);

Contributor
Posts: 24
Registered: ‎11-04-2011
My Device: Bold 9700
My Carrier: Dbydx Software

Re: Customizing default blue color of listfield

 

try this method:

 

listnew.setBackground(BackgroundFactory.createSolidBackground(Color.BLUE));

Trusted Contributor
Posts: 182
Registered: ‎09-22-2011
My Device: 9700
My Carrier: airtel

Re: Customizing default blue color of listfield

Thnx for ur reply,but u didnt followed my question.I dont want to set the background color of the listfield as blue or red,i want the default focus color to change from blue to something else

Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Customizing default blue color of listfield

Hi,

 

Check this link, this is what u need..

 

http://intridea.com/2011/2/25/blackberry-tip-change-the-default-focus-highlight-color-of-listfield?b...

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Highlighted
Developer
Posts: 144
Registered: ‎03-15-2011
My Device: blackberry smart phone
My Carrier: Airtel

Re: Customizing default blue color of listfield

[ Edited ]

override the onFocus() and onUnFocus() method to get that. Set the color as you want when the list is on the focus and when the list get off focus change the color ... may be this will help you

Trusted Contributor
Posts: 182
Registered: ‎09-22-2011
My Device: 9700
My Carrier: airtel

Re: Customizing default blue color of listfield

Thnx everyone for ur replies.I have fixed it in dis manner.I have put this in the drawList method

 

 

if(listnew.getSelectedIndex() == index)
{
g.setColor(0xff0033);
g.fillRect(0,(index*listnew.getRowHeight()),Display.getWidth(),listnew.getRowHeight());
}
listnew.invalidate(index);

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

Re: Customizing default blue color of listfield

Two suggestions:

You should not need the invalidate and you should use the width of the ListField passed in the the drawListRow rather than Display.width().