Use colors for Combobox items

Help is preferred to those who publish their work as Open Source and not as private branches rejecting collaboration. Such projects are not maintainable and shall be deleted.
Forum rules
This forum is personally pruned to avoid redundant posts. Related topics are grouped together. IF YOU HAVE REGISTERED, you need to send email to red1(a)red1.org with your username in the subject title to get me to activate you.

Use colors for Combobox items

Postby nmicoud » Fri Sep 07, 2012 1:41 am

Hi,
I got a combobox (table direct) which shows items from current ad_client and system.
I would like to colorize items according to the ad_client_id (eg : red for 0, green when >0).
I've search a way in *lookup* classes but seems complicated ; any idea ?

on irc, a42niem suggested to have a look at org.compiere.swing.CComboBox.setBackground (Color bg)?

But it seems this is used for coloring the field and not his items.

To summarize : MLookupFactory produces a SQL which stores items in a ArrayList and this list is just shown into a combobox.
And I can't find a place where i could write something like "item.setColor(Color.RED);"


Any ideas ?

Thanks

Nicolas
nmicoud
Regular
 
Posts: 137
Joined: Fri Oct 07, 2011 6:19 pm

Re: Use colors for Combobox items

Postby nmicoud » Fri Sep 07, 2012 10:03 pm

as a workaround, i've added a prefix for every items.
Anyway, if someone know how to put some colors, i'd be interested !

Regards,

Nicolas
nmicoud
Regular
 
Posts: 137
Joined: Fri Oct 07, 2011 6:19 pm

Re: Use colors for Combobox items

Postby red1 » Sat Oct 13, 2012 8:46 am

Just making a stupid guess here. Maybe look up some Java syntax that says 'font'?
red1
Site Admin
 
Posts: 2759
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia


Return to HELP ME!!!

Who is online

Users browsing this forum: No registered users and 1 guest