use of javax.swing.plaf.basic.BasicTreeUI in project java-swing-tips by aterai.
the class RowSelectionTree method updateUI.
@Override
public void updateUI() {
//removeFocusListener(handler);
super.updateUI();
setUI(new BasicTreeUI() {
@Override
public Rectangle getPathBounds(JTree tree, TreePath path) {
if (Objects.nonNull(tree) && Objects.nonNull(treeState)) {
return getPathBounds(path, tree.getInsets(), new Rectangle());
}
return null;
}
private Rectangle getPathBounds(TreePath path, Insets insets, Rectangle bounds) {
Rectangle rect = treeState.getBounds(path, bounds);
if (Objects.nonNull(rect)) {
rect.width = tree.getWidth();
rect.y += insets.top;
}
return rect;
}
});
UIManager.put("Tree.repaintWholeRow", Boolean.TRUE);
//handler = new Handler();
//addFocusListener(handler);
setCellRenderer(new Handler());
setOpaque(false);
}
Aggregations