getDocument in MViewPane returns null after setDocument

User c23c5e9da4

23-01-2007 17:29:29

Calling MViewPane.getDocument(0) always returns null. See example below.





import chemaxon.marvin.beans.MViewPane;


import chemaxon.struc.MDocument;


import chemaxon.formats.MolImporter;





public class MarvinEmptyDocument {


public static void main(String[] args) throws Exception {


MViewPane p = new MViewPane();


p.setDocument(0, new MDocument(MolImporter.importMol("c1ccccc1")));


System.err.println(p.getDocument(0));


}


}





Prints out "null"

ChemAxon 7c2d26e5cf

24-01-2007 09:23:42

Indeed. Thanks for the bug report.


I've fixed it. The bugfix will be available in next Marvin release (4.1.6).


Until then, I suggest the following workaround to get the document:


Code:
MViewPane viewpanel = ...


MDocuments[] docs = viewpanel.getDocuments();


if(docs != null) System.err.println(docs[0]);