diff options
author | Mark Wielaard <mark@klomp.org> | 2006-12-03 16:14:38 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2006-12-03 16:14:38 +0000 |
commit | 46f024912047b0c71e31ad0e1e2901b50c707986 (patch) | |
tree | d4b325e3d8ac5e3bea1f28f948b401e12b9b56f0 | |
parent | 8f6f041f901791c919ec5e349d1b690610b6f6bd (diff) | |
download | classpath-46f024912047b0c71e31ad0e1e2901b50c707986.tar.gz |
* javax/swing/plaf/basic/BasicTreeUI.java (paint): Check whether
path[k] is null.
(isLastChild): Return false when path is null.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | javax/swing/plaf/basic/BasicTreeUI.java | 22 |
2 files changed, 20 insertions, 8 deletions
@@ -1,5 +1,11 @@ 2006-12-03 Mark Wielaard <mark@klomp.org> + * javax/swing/plaf/basic/BasicTreeUI.java (paint): Check whether + path[k] is null. + (isLastChild): Return false when path is null. + +2006-12-03 Mark Wielaard <mark@klomp.org> + * gnu/java/awt/peer/gtk/GtkComponentPeer.java (paintArea): Renamed to currentPaintArea. (paintComponent): Work with local reference to currentPaintArea. diff --git a/javax/swing/plaf/basic/BasicTreeUI.java b/javax/swing/plaf/basic/BasicTreeUI.java index db54a1e66..2c8c1e0b7 100644 --- a/javax/swing/plaf/basic/BasicTreeUI.java +++ b/javax/swing/plaf/basic/BasicTreeUI.java @@ -1587,12 +1587,15 @@ public class BasicTreeUI for (int i = startIndex; i <= endIndex; i++, k++) { path[k] = treeState.getPathForRow(i); - isLeaf[k] = treeModel.isLeaf(path[k].getLastPathComponent()); - isExpanded[k] = tree.isExpanded(path[k]); - bounds[k] = getPathBounds(tree, path[k]); + if (path[k] != null) + { + isLeaf[k] = treeModel.isLeaf(path[k].getLastPathComponent()); + isExpanded[k] = tree.isExpanded(path[k]); + bounds[k] = getPathBounds(tree, path[k]); - paintHorizontalPartOfLeg(g, clip, insets, bounds[k], path[k], i, - isExpanded[k], false, isLeaf[k]); + paintHorizontalPartOfLeg(g, clip, insets, bounds[k], path[k], + i, isExpanded[k], false, isLeaf[k]); + } if (isLastChild(path[k])) paintVerticalPartOfLeg(g, clip, insets, path[k]); } @@ -1600,8 +1603,9 @@ public class BasicTreeUI k = 0; for (int i = startIndex; i <= endIndex; i++, k++) { - paintRow(g, clip, insets, bounds[k], path[k], i, isExpanded[k], - false, isLeaf[k]); + if (path[k] != null) + paintRow(g, clip, insets, bounds[k], path[k], i, isExpanded[k], + false, isLeaf[k]); } } } @@ -1611,7 +1615,9 @@ public class BasicTreeUI */ private boolean isLastChild(TreePath path) { - if (path instanceof GnuPath) + if (path == null) + return false; + else if (path instanceof GnuPath) { // Except the seldom case when the layout cache is changed, this // optimized code will be executed. |