Closed Sciss closed 9 years ago
It seems that this tree-table simply renders tree elements on top of the table cells using the tree renderer (that is fine, usually) together with table renderer (that is strange). And since in WebLaF tree renderer is totally different from table renderer you see this effect.
I guess tree renderer just needs a small patch for this specific case as it was not designed to be used this way. I will see what i can do about it.
I just checked your TreeTable - it is a bit weird, the way you paint it I mean :) You are painting tree on top of the table, and of course you are getting such artifacts. This might also cause some other issues with other L&Fs - its just luck that Nimbus has similar table and tree cells display way by default.
But what is more important - tree selection you see (the gray one) comes from the tree itself, not the tree renderer. I have changed the way tree selection is painted a few versions ago to make it more convenient and customizable. So usually with components like Jide or NetBeans TreeTable you will never see it because they use only tree renderer and some custom painting to display cells. But in your case the whole tree is painted.
I am not sure how can i help with this situation.
Ok, I found a work-around. In the TreeTable UI, I have to avoid setting the text foreground color for selected tree cells when WebLaF is active. That way, the default color (black) is retained and it looks readable again (although I'd generally prefer not to render the gray selection box at all).
I think i will add an option to disable selection rendering in the tree background, that should actually fix your issue without affecting the way WebLaF works wit tree selection :)
Ok, thanks. The best would be to use something similar to nimbus-overrides or a client property, that way I can change that settings independently of whether WebLaF is on the classpath or not.
The same happens with JXTreeTable from swingx. The default tree selection makes the whole treetable selection very buggy when used with weblaf.
Would you have a quick work-around to disable the gray selection box? Thanks
I have added a small change that allows custom tree selection to be switched off.
It can be disabled globally:
WebTreeStyle.selectionStyle = TreeSelectionStyle.none;
Or for specific tree or UI instance:
final WebTree tree = new WebTree ();
tree.setSelectionStyle ( TreeSelectionStyle.none );
final JTree tree = new JTree ();
( ( WebTreeUI ) tree.getUI () ).setSelectionStyle ( TreeSelectionStyle.none );
So if you have access to tree table tree instance you can now switch it off so it doesn't interfere with selection painted by renderer or tree table component.
I guess that should also close this question :) Still, if something is not yet right - feel free to reopen it.
Thanks, that's splendid!
However I could not specifically disable the selection style of my JXTreeTable
because JXTreeTable.getUI()
gives a TableUI
and not a TreeUI
. The global disabling worked though.
And for the other JTrees in my GUI, the selection style disappeared so I had to enable it again:
.setSelectionStyle ( TreeSelectionStyle.line );
You might probably access the tree which JXTreeTable
uses somehow.
Probably through Reflection - it will still be better than override other trees style every time.
Or you can simply set global selection style to none
before creating another JXTreeTable
and then set it back to line
after you have initialized it. That should initialize JXTreeTable
with none
style but will let you avoid customizing other trees.
I am using a TreeTable component. That basically nests JTrees inside a JTable. It works fine for most look-and-feels I have tested, but with WebLAF there is this oddity of two types of cell renderers: Table cells use blue background and white foreground, whereas trees (like lists) use a black outline instead. Somehow I end up having white text on light gray background (top to bottom: TreeTable/Tree/Table):
In comparison, Nimbus:
Is there a simple trick to configure a JList or a JTree to use table style cell rendering instead of the outline?