summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--javax/swing/plaf/basic/BasicTreeUI.java16
2 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c6e49cf1f..3bf829d48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2007-04-03 Roman Kennke <roman@kennke.org>
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPathBounds): Consider the tree's insets. Added a bunch of
+ null checks.
+
+2007-04-03 Roman Kennke <roman@kennke.org>
+
* javax/swing/plaf/basic/BasicLabelUI.java
(cachedInsets): New field. Used for reusing the insets instance.
(getFontMetrics): New helper method for fetching a suitable
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.