2005-07-15 Lillian Angel <[EMAIL PROTECTED]>
* javax/swing/plaf/basic/BasicTreeUI.java
(mouseClicked): Implemented clicking on control icons.
Index: javax/swing/plaf/basic/BasicTreeUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.37
diff -u -r1.37 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java 15 Jul 2005 17:53:09 -0000 1.37
+++ javax/swing/plaf/basic/BasicTreeUI.java 15 Jul 2005 20:35:18 -0000
@@ -1932,23 +1932,31 @@
TreePath path = BasicTreeUI.this.tree.getPathForRow(row);
boolean inBounds = false;
+ boolean cntlClick = false;
Rectangle bounds = BasicTreeUI.this.getPathBounds(
BasicTreeUI.this.tree, path);
int x = (int) bounds.getX();
int y = (int) bounds.getY();
- if ((clickY >= (y - 10) && clickY <= (y + bounds.height + 10))
- && (clickX >= x && clickX <= (x + bounds.width + 25)))
- inBounds = true;
- if (inBounds && path != null && BasicTreeUI.this.tree.isVisible(path))
+ if (clickY > y && clickY < (y + bounds.height + 10))
+ {
+ if (clickX > x && clickX < (x + bounds.width + 20))
+ inBounds = true;
+ else if (clickX < (x - rightChildIndent + 5) &&
+ clickX > (x - rightChildIndent - 5))
+ cntlClick = true;
+ }
+
+ if ((inBounds || cntlClick) && path != null &&
+ BasicTreeUI.this.tree.isVisible(path))
{
- if (!BasicTreeUI.this.isLeaf(row))
+ if (!cntlClick && !BasicTreeUI.this.isLeaf(row))
clickCount++;
- if (clickCount == 2)
+ if (clickCount == 2 || cntlClick == true)
{
- BasicTreeUI.this.tree.getSelectionModel().clearSelection();
clickCount = 0;
+ BasicTreeUI.this.tree.getSelectionModel().clearSelection();
if (BasicTreeUI.this.tree.isExpanded(path))
{
BasicTreeUI.this.tree.collapsePath(path);
@@ -1960,7 +1968,7 @@
BasicTreeUI.this.tree.fireTreeExpanded(path);
}
}
-
+
BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, path);
}
}
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches