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
New Contributor
kishore2012
Posts: 5
Registered: ‎08-23-2012
My Carrier: Blackberry

Change Background of Manager when it is Focused.

Hi,

I just create the HorizontalFieldManager with background, i cant get whether my hfm is focused or not. so i want code to change the background when it is focused.

Please use plain text.
New Developer
UmaVenkateswararao1200
Posts: 13
Registered: ‎04-26-2012
My Carrier: Blackberry

Re: Change Background of Manager when it is Focused.

use this code.................

Bitmap focusImg=Bitmap.getBitmapResource("focus.png");
Bitmap unFocusImg=Bitmap.getBitmapResource("unfocus.png");
Bitmap button=unFocusImg;
HorizontalFieldManager hfm=new HorizontalFieldManager()
{
protected void paint(Graphics graphics)
{
graphics.drawBitmap(0, 0, fieldWidth, fieldHeight, button, 0, 0);
}

protected void onFocus(int direction)
{
button=focusImg;
hfm.invalidate();
}
protected void onFocus(int direction)
{
button=unFocusImg;
hfm.invalidate();
}
}
Please use plain text.
Developer
kamal_nigam
Posts: 416
Registered: ‎07-23-2012
My Carrier: Orange

Re: Change Background of Manager when it is Focused.

I will suggest you should check the particular component in the manager instead of entire manager

Thanks
-------------------------------------------------------------------------------------
Press the Accept as solution Button when u got the Solution
Press Kudo to say thank to developer.
-------------------------------------------------------------------------------------.
Please use plain text.