java - Detect when expand/collapse (plus/minus) icon is clicked in JTree -
i'm writing mouselistener
replace default clicking behaviour in jtree
. how can tell when icon clicked can expand row myself? (i know default behaviour, i'm replacing default mouselistener
own mouselistener
).
here's code:
// custom mouse listener tree mouselistener treemouselistener = new mouseadapter() { public void mousepressed (mouseevent e) { treepath path = cameratree.getpathforlocation(e.getx(), e.gety()); // methods based on clicked ... } };
the treepath returned cameratree.getpathforlocation(e.getx(), e.gety())
null when clicking on +/- icon. how can tell when +/- icon clicked?
if using jtree, use treeselectionlistener. more info here: http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html
Comments
Post a Comment