问题
I have inserted one image in the tree body in one of my columns with
new TreeImagePainter(true, GUIHelper.getImage("right"), GUIHelper.getImage("right_down"), image);
in class TreeConfiguration
, but I need to add one more image beside root rows.
Moreover I need to dynamicly obtain this image from some other class, where data is already read . As it turns out i can't because either this class is null or it is called later than it should. Could you guild me how to do that.
Kind Regards
回答1:
The painting of the tree structure with node icons etc. is done by the IndentedTreeImagePainter
. The TreeImagePainter
is used as a decorator to the base painter for the content (typically text). If you need an additional icon you need to wrap the IndentedTreeImagePainter
with another CellPainterDecorator
.
Or in case the additional icon should be on the right of the tree icon, maybe the base painter can already be a CellPainterDecorator
that combines both, an ImagePainter
and a TextPainter
.
If you only want to show that icon on root nodes, you will need some more customization, probably with a custom painter.
Sorry, I don't really understand your requirement.
来源:https://stackoverflow.com/questions/38585691/2-image-in-root-of-tree-in-nattable