BlackBerryForums.com : Your Number One BlackBerry Community      

»Sponsored Links



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
sgallego Offline
Knows Where the Search Button Is
 
Posts: 15
Join Date: Dec 2007
Location: Spain
Model: 8100
Carrier: Vodafone
Default ListField Background Color - 05-09-2008, 03:36 AM

Hi!!

I'm trying to set the background color in a ListField. I've developed a ListFieldCallback to paint the list. The method looks like this:


public void drawListRow( ListField list, Graphics g, int index, int y, int w) {
String text = (String)listElements.elementAt(index);
if( index % 2 == 1){
g.setColor(0x00555555);
g.setBackgroundColor(0x00ff0000);
}
Font defaultfont = Font.getDefault();
Font boldfont = defaultfont.derive(Font.BOLD,18);
g.setFont(boldfont);
g.drawText(text, 0, y, 0, w);
}

Font color changes correctly...but backgroundcolor not!!! any idea???

Regards
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
Ivanov Offline
Thumbs Must Hurt
 
Posts: 101
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Default 05-09-2008, 04:43 AM

Look at this:
How To - Create a colour ListField
   
Reply With Quote
  (#3 (permalink)) Old
simon.hain Offline
CrackBerry Addict
 
Posts: 624
Join Date: Apr 2005
Location: hamburg, germany
Model: 8700
Carrier: o2
Default 05-09-2008, 04:46 AM

edit: Ivanovs method seems to be better


java developer, Devinto, hamburg/germany

Last edited by simon.hain : 05-09-2008 at 04:48 AM.
   
Reply With Quote
  (#4 (permalink)) Old
sgallego Offline
Knows Where the Search Button Is
 
Posts: 15
Join Date: Dec 2007
Location: Spain
Model: 8100
Carrier: Vodafone
Smile 05-13-2008, 05:31 AM

Thank you very much! It is very easy to do!
   
Reply With Quote
Reply


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-2008 BlackBerryNews.com, BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.1