I also have a version of the panel that makes use of SimpleViewer.
And now it's working o_O, I have the popup menu triggered at right
clic. Here is the code:
public class JmolPanel extends JPanel
{
private static final long serialVersionUID = -3661941083797644242L;
private JmolSimpleViewer viewer;
private JmolAdapter adapter;
public JmolPanel() {
adapter = new SmarterJmolAdapter();
viewer = JmolSimpleViewer.allocateSimpleViewer(this, adapter);
}
public JmolSimpleViewer getViewer() {
return viewer;
}
public void executeCmd(String rasmolScript) {
viewer.evalString(rasmolScript);
}
public void setStructure(Structure s)
{
String pdb = s.toPDB();
viewer.openStringInline(pdb);
}
final Dimension currentSize = new Dimension();
final Rectangle rectClip = new Rectangle();
@Override
public void paint(Graphics g) {
getSize(currentSize);
g.getClipBounds(rectClip);
viewer.renderScreenImage(g, currentSize, rectClip);
}
}
I'm quite dubitative though, I don't understand why it didn't worked
previously as it was the first tryout, and I think it was quite the
same piece of code...
Anyway, the previous code that makes use of the Viewer class directly
is not working cauz there is a nullpointerException thrown when right
clicking on the panel:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.jmol.viewer.Viewer.getSelectionHaloEnabled(Unknown Source)
at org.jmol.viewer.Viewer.getBooleanProperty(Unknown Source)
at org.jmol.viewer.Viewer.getBooleanProperty(Unknown Source)
at org.jmol.popup.JmolPopup.show(Unknown Source)
at org.jmol.viewer.Viewer.popupMenu(Unknown Source)
at org.jmol.viewer.MouseManager.mousePressed(Unknown Source)
at org.jmol.viewer.MouseManager11.mousePressed(Unknown Source)
Anyway, I think I have what I need for the moment, thank you very much
for your help. No doubt I will come back soon for more information on
customizing all these stuffs :)
Thanks again.
Vincent.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users