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
New Developer
Posts: 43
Registered: ‎05-12-2009
My Device: Not Specified
Accepted Solution

need to set color of labelfield.

Hi all,


            Can any one suggest me ,how can i set color of labelfield ?

I can able to set font but i m not able to get how will i set font color as well.

 

ajay

Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: need to set color of labelfield.

Hi,

 

Try this hope it will help you.

 

 LabelField lblTitle = new LabelField("",LabelField.USE_ALL_WIDTH){
                            public void paint(Graphics g){      
                                 g.setBackgroundColor(Color.BLACK);
                                 g.fillRect(0,0,getWidth(),getHeight());
                                 g.setColor(Color.WHITE);
                                 g.clear();
                                 super.paint(g);
                            }    
       };

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
New Developer
Posts: 6
Registered: ‎05-28-2009
My Device: Not Specified

Re: need to set color of labelfield.

 

 

LabelField objLabel = new LabelField("test test"){ public void paint(Graphics g){ g.setColor(Color.RED); super.paint(g); } };

 

Try this let me know.

 

New Developer
Posts: 43
Registered: ‎05-12-2009
My Device: Not Specified

Re: need to set color of labelfield.

hey thx all !   :-)
Visitor
Posts: 1
Registered: ‎07-24-2011
My Device: 9800
My Carrier: student

Re: need to set color of labelfield.

 label0=new LabelField(" Label",LabelField.USE_ALL_WIDTH){
       
        public void paint(Graphics g)
        {
           
        g.setBackgroundColor(colorCode);
        g.fillRect(0,0,getWidth(),getHeight());
        g.setColor(Color.BLACK);
        g.drawText("Label",0, 0);
        g.clear();
        super.paint(g);
        }   
     };
  This code change the color of the label but I can't  modify the position of the text in the middle Smiley Sad

Highlighted
New Contributor
Posts: 5
Registered: ‎04-02-2012
My Device: 9900
My Carrier: m

Re: need to set color of labelfield.

i am setting data in labelfield and that data is comming from serverside.

i set that field at verticalFieldManage to show it in grid view but when i am trying to set background color with your method it have no change on color on my label.