mviewpane API

User 48b145d3f5

31-01-2011 17:46:09

I have implemented the code below as part of a JAVA application

 I needed to use the JComponent to be able to add the mouselistener to mviewpane.

However, the use of this JComponent causes problems when I double click mviewpane: now the molecule modified with msketch is not updated in the mviewpane and disappears from the mviewpane itself.

What should I do to fix this?

 

Thank you

 


MViewPane mviewPane=



new MViewPane();



mviewPane.setEditable(MViewPane.



SKETCHABLE);



mviewPane.setM(mol,0);



JComponent comp



 



= mviewPane.getVisibleCellComponent(0);


comp.setName(String.valueOf(i));


comp.addMouseListener(l);



 



 



 



 


ChemAxon e274e1bada

31-01-2011 17:51:25

I have moved this topic to the appropriate forum, the Marvin experts will respond soon.


Regards, Edvard

ChemAxon 7c2d26e5cf

01-02-2011 11:38:00

I have created a simple test application (based on your code) to check custom mouse listener. See the attached example.


But I have not found any problem: after double click, molecule can be edited. As I closed sketcher, updated structure was appeared in viewer.


Which Marvin version do you use?


Please try the attached example with your Marvin instance. Does it work for you?


Is this code suitable for you?

User 48b145d3f5

01-02-2011 19:45:40

Thank you Tamas.


It works now, before I was adding mviewPane to comp instead of adding it to the JFrame.


Francesca

ChemAxon 7c2d26e5cf

02-02-2011 14:03:09

I am glad that I could help you. Thanks for the feedback.