org.jgraph.graph 中有没有getImage这个方法啊是否可以这样调用呢???
  BufferedImage img=graph.getImage(graph.getBackground(),1 );

解决方案 »

  1.   

    我也才接触JAVA   既然没有这个方法怎么调用啊?
    如果有这个方法就IMPORT导入就可以了。我手头没这个包的资料
      

  2.   

    你说的应该是JGraph吧,去网上下载个jar包,用到的时候import进去了。
    你说的org.jgraph.graph,graph首字母是小写的应该是个包名而不是类名,所以肯定不能像你那样调用。自己去查查JGraph相关的资料吧
      

  3.   

    帮你查了一下他的api首先class叫JGraph所以是org.jgraph.JGraph
    他有getImage方法但是不是静态的需要首先创建一个JGraph对象
    然后我想你可以用BufferedImage img=graph.getImage(graph.getBackground(),1 );参数类型应该是对的
    附上方法的javadoc
    public BufferedImage getImage(Color bg,
                                  int inset)Returns a BufferedImage for the graph using inset as an empty border around the cells of the graph. If bg is null then a transparent background is applied to the image, else the background is filled with the bg color. Therefore, one should only use a null background if the fileformat support transparency, eg. GIF and PNG. For JPG, you can use Color.WHITE for example. Returns:
    Returns an image of the graph.