Ok, I haven't been able to get this to work.
This is what I have done:
1. Defined the following in the simple.xml theme:
Code:
<theme name="iconcellrenderer" ref="-defaults" allowWildcard="true">
<param name="icons"><map>
<param name="testImg"><image>-iconC</image></param>
</map></param>
</theme>
So I have an icon called "testImg" so the IconCellRenderer can read it in and use it.
2. I made my own TreeNode, which is a copy of MyNode from the TWL demo.
3. I made my own TestTreeModel, which is the following (I'm going to clean it up later, ie: remove "Test", etc):
Code:
public class TestTreeModel extends AbstractTreeTableModel
{
@Override
public int getNumColumns ()
{
return 1;
}
@Override
public String getColumnHeaderText ( int column )
{
return "";
}
public TreeNode insert(Object str0, String str1) {
TreeNode n = new TreeNode(this, str0, str1);
insertChild(n, getNumChildren());
return n;
}
}
4. I made my TreeComboBox in the code, like so:
Code:
TestTreeModel treeTableModel = new TestTreeModel();
treeTableModel.insert(new DecoratedTextWithIcon("HI", 0, "testImg"), "1");
flagComboBox = new TreeComboBox(treeTableModel);
flagComboBox.getTreeTable().registerCellRenderer(DecoratedTextWithIcon.class, new IconCellRenderer());
flagComboBox.setTheme("treecombobox");
flagComboBox.setPosition(x, y);
add(flagComboBox);
When I load this up, the UI looks just fine, and I get no errors. When I open the combobox, I see only "HI", not the image that was loaded from the theme file. When I select this item, it changes the selected value to be "HI /", and no image is present.
I put some printlns in the IconCellRenderer to see if the image was being used (draw method), and it does get down there.
On a side note, how do I remove the "/" from the selected text? This Combobox will be displaying only 1 item, not multple.
Also!
After I figure this out, I am going to write my own custom widget so (hopefully) I can easily add images to the Comboboxes in a very encapsulated form. I was wondering if I could possibily donate this to the TWL library? You have helped out me a lot (and of course others), so it is the least I can do to give back

.
Thanks!