hello friends! i have a query and i will highly appreciate it if you could help me out. I WANT TO ADD DIFFERENT ITEMS IN A LIST BOX OR CHOICE BOX. Is it possible? I will look forward to your reply. regards, ankush
The Foreground and Background colors are set for a complete component. In order to have different colors, each item in the list would need to be a different component. The only way (that I know of) to accomplish this is to use a Tree like perhaps JTree or TreeSet etc.
"JavaRanch, where the deer and the Certified play" - David O'Meara
You may want to look at " list cell renderer" or list selection models in the javadoc. I have seen people use icons in list boxes (I think) and I believe that each item in a list is a Label object. Obviously, I only have a superficial understanding but I think you can accomplish what you are after. Check out the two areas above in javadoc (Interface ListCellRenderer, DefaultListCellRenderer). I hope that is of some use.
subject: is it possible to show different colors in choice or list box?