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
rakesh86shankar
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified
Accepted Solution

how to change the background color of horizontal field Manager

can anyone say ,how to hange the background color of horizontal field Manager(hfm)

 

whether we should extend it and override in ppaint,i tried it

 

i got Color of hfm in label that i added to it

 

any give me idea 

Developer
mantaker
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: how to change the background color of horizontal field Manager

Overriding paint is the way... Yes you are getting expected results..
--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
bikas
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: how to change the background color of horizontal field Manager

Try this:

 

HorizontalFieldManager manager = new HorizontalFieldManager() { public void paint(Graphics graphics) { graphics.setBackgroundColor(0x000000FF);//blue graphics.clear(); super.paint(graphics); } };

 

Regards

Bikas

 

 

Developer
Petruchodd
Posts: 39
Registered: ‎10-19-2010
My Device: drova 9700

Re: how to change the background color of horizontal field Manager

can any one help me. I need  set new background image when i clicked on horizontalfieldmanager( i use it because its need for me, i need only change background image)

i used drawBitmap for set on background. But i don't know how to change this images when onClickevent.

 

TouchHFM hfm = new TouchHFM()

{

 

public void paint(Graphics graphics)  {
   graphics.clear();
   graphics.drawBitmap(0, 0, bar_blue.getWidth(), bar_blue.getHeight(),bar_blue, 0, 0);
  graphics.drawBitmap(Display.getWidth()-20, 0, 10, bar_blue.getHeight(),bar_blue, bar_blue.getWidth()-10, 0);
super.paint(graphics);
   
}
}

 

 

anyone can help me ? please

 

Regards,Peter.

p.s. Sorry for my bad English

Developer
YamilBracho
Posts: 713
Registered: ‎05-31-2010
My Device: 8520

Re: how to change the background color of horizontal field Manager

Load the new bitmap into bar_blue and then call hfm.invalidate(). Maybe you have to move bar_blue and hfm as instance vars...

Developer
Petruchodd
Posts: 39
Registered: ‎10-19-2010
My Device: drova 9700

Re: how to change the background color of horizontal field Manager

[ Edited ]

 But  i have 10-15 hfm (TouchHFM). And when clicked on one( not first)  field... bar_blue is changed (hfm have new background). But changed all fields from first to n (where n is clicked field).

What i must do.. for changing only one field.. which i clicked  : (

i can't ... or not understand how work the onFocus and UnFocus. I tried with colors.. but nothing happens.

help (

 

then.. where i must call hfm.validate ? i have listener for touch(click) on the hfm. 

 

if can.. please some sample..

 

Regards, Peter.

Developer
bb2010
Posts: 157
Registered: ‎03-29-2010
My Device: 8300

Re: how to change the background color of horizontal field Manager

Thank You bikas