JXTreeTable and BorderHighlighter Drawing Border on All Rows

Posted by Kevin Rubin on Stack Overflow See other posts from Stack Overflow or by Kevin Rubin
Published on 2014-05-27T15:21:55Z Indexed on 2014/05/27 15:24 UTC
Read the original article Hit count: 269

Filed under:
|
|

I'm using a BorderHighlighter on my JXTreeTable to put a border above each of the table cells on non-leaf rows to give a more clear visual separator for users.

The problem is that when I expand the hierarchical column, all cells in the hierarchical column, for all rows, include the Border from the Highlighter. The other columns are displaying just fine.

My BorderHighlighter is defined like this:

Highlighter topHighlighter = new BorderHighlighter(new HighlightPredicate() {
    @Override
    public boolean isHighlighted(Component component, ComponentAdapter adapter) {
        TreePath path = treeTable.getPathForRow(adapter.row);
        TreeTableModel model = treeTable.getTreeTableModel();
        Boolean isParent = !model.isLeaf(path.getLastPathComponent());
        return isParent;
    }
}, BorderFactory.createMatteBorder(2, 0, 0, 0, Color.RED));

I'm using SwingX 1.6.5.

© Stack Overflow or respective owner

Related posts about java

Related posts about swingx