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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -