Invoke action with doubleclick on Jtree node

Answered

I have a JTree with nodes and an action I would like to invoke by double clicking on one of the nodes.

I`ve implemented a MouseListener to check if the user makes a double click on the node.

Now I have the problem that the actionPerformed method which I want to invoke needs an "AnActionEvent". Is there a way to manually create one? Or how can I generally invoke the "actionPerformed" method with another method?

4 comments
Comment actions Permalink

com.intellij.ide.DataManager#getDataContext(java.awt.Component) to obtain DataContext from current component.

0
Comment actions Permalink

Could you please provide some more information how to do that? What is the "component"? 

Thank you in advance!

0
Comment actions Permalink

Any java.awt.Component, e.g. in this case your JTree

0
Comment actions Permalink

Thank you! Now it works.

0

Please sign in to leave a comment.