If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Trusted Contributor
sowjanya1919
Posts: 109
Registered: ‎08-21-2012
My Device: Blackberry curve
My Carrier: company
Accepted Solution

label background

i have a series of label for which i am changing the background color using paint method. Now the problem is i define a small button first and then this labels .when i am moving the cursor from button to label ,only a small part of label background color is changing not the whole label width .Actuall  Graphics is considering the above button width to set the color for label...Can anyone tell me how to set this

Please use plain text.
Developer
simon_hain
Posts: 15,892
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: label background

please post a code snippet, hard to say without taking a look
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Trusted Contributor
sowjanya1919
Posts: 109
Registered: ‎08-21-2012
My Device: Blackberry curve
My Carrier: company

Re: label background

Thanks for responding ...but now my problem has solved ..Inside the paint method i define solidbackgroound() and the setbackgroundcolor() like this:

Here content is a array of label fields.

 

content[i]=new CustomLabelField(s, 1449770, 22,0){
           
              public int getPreferredHeight()
                 {
                         return(30);  
                 }
                 public int getPreferredWidth()
                 {  
                        return(210);   
                 }
                protected void sublayout(int maxWidth,int maxHeight)
                {
                    super.layout(getPreferredWidth(),getPreferredHeight());
                    setExtent(getPreferredWidth(),getPreferredHeight());
                }
                
                 public void paint(Graphics graphics)
                    {
                     //..blue...
                     if(focus[j]==1)
                     {
                    
                        Background bg = BackgroundFactory.createSolidTransparentBackground(0xF0F0F1, 50);
                        setBackground(bg);
                       graphics.setBackgroundColor(1535207);
                       graphics.clear(0, 0, 210, 210);
                     
                     
                     }else{
                        
                     }
                     super.paint(graphics);
                    }    
            
           };

 

Please use plain text.