2008-07-05
将 JGraph 图导出为图片文件
虽说用户使用手册中有比较详细的说明, 但在此再举一例。
代码:
| FileOutputStream out = new FileOutputStream(outfile); Color bg = graph.getBackground(); BufferedImage img = graph.getImage(bg, 0); try { ImageIO.write(img, "png", out); } catch (IOException e) { e.printStackTrace(); } |
呵呵, 这样自己印象也比较深了。
JGraph 生成的图形也就可以保存到 Excel 和 Word 中了.







评论排行榜