diff options
author | Mark Wielaard <mark@klomp.org> | 2006-12-04 21:17:20 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2006-12-04 21:17:20 +0000 |
commit | 3c8afd2e2d8f20d98889e8b5abc5180d130d224c (patch) | |
tree | 558d87396413c008cdd764b4e7d8d4ce74eba2a0 | |
parent | 6ae24ae28a2f2e3a63ebcf16bc223a206144874f (diff) | |
download | classpath-3c8afd2e2d8f20d98889e8b5abc5180d130d224c.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 ef46efdd2..5b0ffce09 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. |