I'm using Java and I need to save my JGraph. When I open the file I find nothing, the file is a Textdocument
.
String filename="C:\\Users\\asmaa\\Desktop\\PFE\\asma" ;
mxCodecRegistry.register(new mxModelCodec( new mxGraphModel()));
try {
mxGraph graph = graphComponent.getGraph();
// taken from EditorActions class
mxCodec codec = new mxCodec();
String xml = mxXmlUtils.getXml(codec.encode(graph.getModel()));
mxUtils.writeFile(xml,filename );
JOptionPane.showMessageDialog( graphComponent, "File saved to: " + filename);
} catch( Exception ex) {
throw new RuntimeException( ex);
}
Could anyone please tell me what's wrong with my code?