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

Gradient color for default list field

Hi,

 

    Am a fresher in blackberry development. I have tried changing the default blue color focus for list field in blackberry, I have found the solution. Now, I want to set the linear gradient back ground color for list field.i.e, the focus color must be linear gradient color. I have tried a lot, Am not finding the solution. Please suggest the solution for this problem

 

 

Thanks & Regards-

Rabiya

 

Please use plain text.
Developer
jprofitt
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: Gradient color for default list field

Take a look at Graphics.drawShadedFilledPath(), it will let you override the current selected background with your own gradient background.

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

Re: Gradient color for default list field

[ Edited ]

hi,

Thanks for reply.i am using drawShadedFilledPath but it is selecting only one listfield, remaning listfield is not selecting.i tried a lot but i did not get any solution.

here is my code......

 

int[] cols = new int[]{0x7FBEFF, 0x7FBEFF, 0x00FFFFFF, 0x00FFFFFF };

int[] xInds = new int[]{0, Display.getWidth(), Display.getWidth(), 0};

int[] yInds = new int[]{0, 0, listfield.getRowHeight(),listfield.getRowHeight()};

 

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

 

please help me its very urgent.

 

Thanks

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

Re: Gradient color for default list field

Your yInds describes the first row - that's why your gradient color affects only the first row. If you look at the drawListRow method, it has y argument - add that y to each item in yInds and you will be fine. And if you are not using that method and are overriding paint instead, you are doing it wrong.

 

Also, invalidate inside any kind of painting method is insanity itself - get rid of it!

----------------------------------------------------------
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
rabiyabasri
Posts: 49
Registered: ‎12-21-2010
My Device: 9000 Bold Device
My Carrier: software developer

Re: Gradient color for default list field

hi,

 

Thanks a lot................

its working fine.

 

Thanks

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

Re: Gradient color for default list field

Can you mark the thread as solved?

----------------------------------------------------------
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.