summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAudrius Meskauskas <audriusa@Bioinformatics.org>2006-07-04 16:26:49 +0000
committerAudrius Meskauskas <audriusa@Bioinformatics.org>2006-07-04 16:26:49 +0000
commit19cc9c590db267f6ad89891ebba084de9b5f28e4 (patch)
treec143a7c9d9357e4c6b0157a30db9dd7ce8c0281e
parentdd42ef55673a92eeca3e941f482e8ed5ee0f7277 (diff)
downloadclasspath-19cc9c590db267f6ad89891ebba084de9b5f28e4.tar.gz
2006-07-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
PR 28061 * javax/swing/plaf/basic/BasicTreeUI.java (isLocationInExpandControl): Mind the effect of the root visibility on the position of the control. Quess icon width 18. (paintVerticalPartOfLeg): Do no paint the vertical line over first level nodes.
-rw-r--r--ChangeLog8
-rw-r--r--javax/swing/plaf/basic/BasicTreeUI.java25
2 files changed, 29 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e6c9314c7..cbfb99dbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-07-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR 28061
+ * javax/swing/plaf/basic/BasicTreeUI.java (isLocationInExpandControl):
+ Mind the effect of the root visibility on the position of the control.
+ Quess icon width 18. (paintVerticalPartOfLeg): Do no paint the
+ vertical line over first level nodes.
+
2006-07-04 Lillian Angel <langel@redhat.com>
* javax/swing/plaf/basic/BasicMenuUI.java
diff --git a/javax/swing/plaf/basic/BasicTreeUI.java b/javax/swing/plaf/basic/BasicTreeUI.java
index cd37720c7..51e0cd82f 100644
--- a/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/javax/swing/plaf/basic/BasicTreeUI.java
@@ -1828,14 +1828,25 @@ public class BasicTreeUI
boolean cntlClick = false;
if (! treeModel.isLeaf(path.getLastPathComponent()))
{
- int width = 8; // Only guessing.
+ int width;
Icon expandedIcon = getExpandedIcon();
if (expandedIcon != null)
width = expandedIcon.getIconWidth();
+ else
+ // Only guessing. This is the width of
+ // the tree control icon in Metal L&F.
+ width = 18;
Insets i = tree.getInsets();
- int left = getRowX(tree.getRowForPath(path), path.getPathCount() - 1)
- - getRightChildIndent() - width / 2 + i.left;
+
+ int depth;
+ if (isRootVisible())
+ depth = path.getPathCount()-1;
+ else
+ depth = path.getPathCount()-2;
+
+ int left = getRowX(tree.getRowForPath(path), depth)
+ - width + i.left;
cntlClick = mouseX >= left && mouseX <= left + width;
}
return cntlClick;
@@ -3744,7 +3755,13 @@ public class BasicTreeUI
{
Rectangle bounds = getPathBounds(tree, path);
TreePath parent = path.getParentPath();
- if (parent != null)
+
+ boolean paintLine;
+ if (isRootVisible())
+ paintLine = parent != null;
+ else
+ paintLine = parent != null && parent.getPathCount() > 1;
+ if (paintLine)
{
Rectangle parentBounds = getPathBounds(tree, parent);
paintVerticalLine(g, tree, parentBounds.x + 2 * gap,