Page 1 of 1

Cameo Plugin to Implement On-Click Listener

PostPosted: Mon May 13, 2019 9:42 am
by amd0023@uah.edu
Dear NoMagic Forum Member,

I am wanting to implement an on-click listener such that when a project element is clicked, a macro will run.

I know how to implement a ProjectEventListener and a PropertyChangeListener, but I am not sure of how to implement an OnClickListener.
I have researched the documentation and found nothing.

Can you please give me some advice? Any advice would be appreciated.

Thank you!

From,
Austin M. Deavers

Re: Cameo Plugin to Implement On-Click Listener

PostPosted: Tue May 14, 2019 4:09 am
by boris_h
Hi, where do you want to respond on clocks? In the containment tree?

Then something like this might work:
Code: Select all
containmentTree.getTree().addTreeSelectionListener(new TreeSelectionListener() {

@Override
public void valueChanged(TreeSelectionEvent e) {
   DefaultMutableTreeNode selectedNode =
       (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
   ...         
  }
});

Basically the getTree()-Method returns the underlying JTree where you can attach various listeners.

Re: Cameo Plugin to Implement On-Click Listener

PostPosted: Tue May 14, 2019 9:16 am
by amd0023@uah.edu
I figured out the solution.

Thank you for your help!

From,
Austin M. Deavers