BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-15-2008, 03:05 AM   #1 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default ObjectChoiceField

Please Login to Remove!

Hi everone,

I try to change the background color of an ObjectChoiceField.

Code:
list2 = new ObjectChoiceField("" , typeCuisine , 0)
{
    protected void paint( Graphics graphics ) 
    {
        graphics.clear();
        int color = graphics.getColor();
        graphics.setColor( 0x99caf3 );
        graphics.fillRect( 0, 0, Display.getWidth(), Display.getHeight() );
        graphics.setColor( color );

    }
};
So the result is that the background color change but the text isn't displayed.

The choice works because when I clic the list appears.

What's wrong??
Offline  
Old 09-15-2008, 06:34 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

you are not calling super.paint() so you are responsible for painting text as well.

I'm not sure if it works with objectchoicefield but for chageing the background I would try the "common" way

Code:
    protected void paint( Graphics graphics ) 
    {
        graphics.setBackgroundColor(Color.RED);
        graphics.clear();
        
        super.paint(graphics);
    }
Offline  
Old 09-15-2008, 08:19 AM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Allright I simply forget the super.paint().

Thanks a lot
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.