Search in sources :

Example 11 with BasicTreeUI

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);
}
Also used : BasicTreeUI(javax.swing.plaf.basic.BasicTreeUI)

Aggregations

BasicTreeUI (javax.swing.plaf.basic.BasicTreeUI)11 TreeUI (javax.swing.plaf.TreeUI)4 GraphicsConfig (com.intellij.openapi.ui.GraphicsConfig)1 ScalableIcon (com.intellij.openapi.util.ScalableIcon)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 EmptyIcon (com.intellij.util.ui.EmptyIcon)1 WideSelectionTreeUI (com.intellij.util.ui.tree.WideSelectionTreeUI)1 XDebuggerTreeNode (com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode)1 XValueNodeImpl (com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)1 ActionEvent (java.awt.event.ActionEvent)1 Method (java.lang.reflect.Method)1 JTree (javax.swing.JTree)1 TreePath (javax.swing.tree.TreePath)1 Nullable (org.jetbrains.annotations.Nullable)1