From 2e4fdf77fafe62e423f48bf17eade890925f12ef Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Tue, 3 Apr 2007 20:41:03 +0000 Subject: 2007-04-03 Roman Kennke * javax/swing/plaf/basic/BasicTreeUI.java (getPathBounds): Consider the tree's insets. Added a bunch of null checks. --- ChangeLog | 6 ++++++ javax/swing/plaf/basic/BasicTreeUI.java | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6e49cf1f..3bf829d48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-04-03 Roman Kennke + + * javax/swing/plaf/basic/BasicTreeUI.java + (getPathBounds): Consider the tree's insets. Added a bunch of + null checks. + 2007-04-03 Roman Kennke * javax/swing/plaf/basic/BasicLabelUI.java diff --git a/javax/swing/plaf/basic/BasicTreeUI.java b/javax/swing/plaf/basic/BasicTreeUI.java index 5b0ffce09..3952ea18d 100644 --- a/javax/swing/plaf/basic/BasicTreeUI.java +++ b/javax/swing/plaf/basic/BasicTreeUI.java @@ -116,7 +116,7 @@ import javax.swing.tree.VariableHeightLayoutCache; * @author Audrius Meskauskas (audriusa@bioinformatics.org) */ public class BasicTreeUI - extends TreeUI + extends TreeUI { /** * The tree cell editing may be started by the single mouse click on the @@ -656,7 +656,18 @@ public class BasicTreeUI */ public Rectangle getPathBounds(JTree tree, TreePath path) { - return treeState.getBounds(path, new Rectangle()); + Rectangle bounds = null; + if (tree != null && treeState != null) + { + bounds = treeState.getBounds(path, null); + Insets i = tree.getInsets(); + if (bounds != null && i != null) + { + bounds.x += i.left; + bounds.y += i.top; + } + } + return bounds; } /** @@ -1561,7 +1572,6 @@ public class BasicTreeUI int startIndex = tree.getClosestRowForLocation(clip.x, clip.y); int endIndex = tree.getClosestRowForLocation(clip.x + clip.width, clip.y + clip.height); - // Also paint dashes to the invisible nodes below. // These should be painted first, otherwise they may cover // the control icons. -- cgit v1.2.1