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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
zidane_143
Posts: 42
Registered: ‎08-26-2010
Accepted Solution

Rounded Button field with gradient

Hi, i am trying to create a button field that is a rounded rectangle, with a gradient.  I need to have the gradient have the following format:

 

DARK COLOR

LIGHT COLOR

DARK COLOR

 

Need some advice i have used

 

http://www.deepgraysea.com/bbroundedrect.htm

 

to get the basics but im struggling to match the gradient format.

 

Anyone know of a site or code that could help me

Thanks

Please use plain text.
Developer
KushBB
Posts: 374
Registered: ‎04-07-2010
My Carrier: Airtel

Re: Rounded Button field with gradient

I would go for a Custom ButtonField with a Bitmap(as required) as Background...:

 

You can try, here's what will help you do that...

 

http://supportforums.blackberry.com/t5/Java-Development/Custom-ButtonField-with-images/m-p/236956

 

Hope that Helps....

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Please use plain text.
Developer
zidane_143
Posts: 42
Registered: ‎08-26-2010

Re: Rounded Button field with gradient

[ Edited ]

Thanks for the help but i should have said that i cant really use images is there any other way of doing it?

 

if i were to use images how would i handle the different resolutions on the different devices

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

Re: Rounded Button field with gradient

Here is a post a while back (if you searched for 'gradient' you would have found it yourself) which deals with this exact problem:

 

Re: gradient color in JDE 4.5 

 

I was wrong back then about not being able to use drawShadedFilledPath under pre-4.6 (you can!), however, so you should be able to just use the code from the quoted article with minimal modifications (just throw out all setBorder and setBackground calls). My code there, however, shows how to create a gradient color Bitmap yourself, which might be useful for you anyway...

 

Good luck!

 

----------------------------------------------------------
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.
Developer
zidane_143
Posts: 42
Registered: ‎08-26-2010

Re: Rounded Button field with gradient

Thanks for the help,

 

In all honestly i did  search for gradient but must have missed it. 

 

Please use plain text.