Question

I'm building a JXTreeTable in which there are only two levels below the hidden root, so I want a border separating the top level nodes. However, when I use the BorderHighlighter, it's not drawing the hierarchical column correctly.

Just moving the mouse over the table results in continuously adding the border to the hierarchical cells until eventually the whole column is black.

I built a small example using JXTableTree sample code from a number of sites, including [InformIT] where I copy/pasted the code to build.2

I just added the highlighter code to the main() method in the example.

Highlighter topHighlighter = new BorderHighlighter(new HighlightPredicate() {
    @Override
    public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
        return true;
    }
}, BorderFactory.createMatteBorder(1, 0, 0, 0, Color.BLACK));
treeTable.addHighlighter(topHighlighter);

I've tried with what I think is the latest SwingX, version 1.6.4.

Was it helpful?

Solution

Final Update

the issue is fixed as of revision #4239, so will be available in the next release (or checking out the current code base)

Original

It's a bug (not sure if we already have an issue), if it's the same effect as can be seen in the SwingLabs demo application:

  • choose Highlighter demo in the tasks at the left
  • choose the JXTreeTable tab in the demos at the right
  • choose BorderHighlighter in the highlighter combo
  • choose Always On in the predicate combo

The underlying reason is that the hierarchical column is rendered by showing a clipped region of one single tree. So Highlighters are applied on the tree as a whole, some - like borders - with nasty effects.

At the moment, the only way out is to not use such Highlighters. Not entirely sure, if there ever will/can be a satisfying solution.

Update

Filed an issue in the SwingX tracker, so we don't forget.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top