Browse Source

Ensure any controls of parents are made visible if possible when navigating JTree.

pull/214/head
weisj 4 years ago
parent
commit
67407b3e8b
  1. 20
      core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java

20
core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java

@ -694,17 +694,15 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener, C
protected void scrollRowToVisible(final JTree tree, final int row) {
Rectangle bounds = tree.getRowBounds(row);
if (!isLeaf(tree, row)) {
boolean expanded = tree.isExpanded(row);
BasicTreeUI ui = DarkUIUtil.getUIOfType(tree.getUI(), BasicTreeUI.class);
if (ui != null) {
Icon icon = expanded ? ui.getExpandedIcon() : ui.getCollapsedIcon();
boolean ltr = tree.getComponentOrientation().isLeftToRight();
int ident = ui.getRightChildIndent();
int extra = ident - 1 + icon.getIconWidth() / 2;
if (ltr) bounds.x -= extra;
bounds.width += extra;
}
boolean expanded = tree.isExpanded(row);
BasicTreeUI ui = DarkUIUtil.getUIOfType(tree.getUI(), BasicTreeUI.class);
if (ui != null) {
Icon icon = expanded ? ui.getExpandedIcon() : ui.getCollapsedIcon();
boolean ltr = tree.getComponentOrientation().isLeftToRight();
int ident = ui.getRightChildIndent();
int extra = ident - 1 + icon.getIconWidth() / 2;
if (ltr) bounds.x -= extra;
bounds.width += extra;
}
tree.scrollRectToVisible(bounds);
}

Loading…
Cancel
Save