如何保存JGraph?

时间:2016-04-24 16:07:47

标签: java jgraph

我正在使用Java,我需要保存我的JGraph。当我打开文件时我什么也没找到,该文件是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); }

protected override async Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
{
    StorageFile dataFile = await Package.Current.InstalledLocation.GetFileAsync("xx.db3");
    await dataFile.CopyAsync(ApplicationData.Current.LocalFolder, "xx.db3", NameCollisionOption.FailIfExists);

    NavigationService.Navigate("Main", null);
    Window.Current.Activate();
}

有人可以告诉我我的代码有什么问题吗?

0 个答案:

没有答案