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  




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