【问题标题】:How to replace an image with mxgraph如何用 mxgraph 替换图像
【发布时间】:2019-03-05 13:44:58
【问题描述】:

我是一个新的 mxgraph 用户,所以我对 mxgraph 的了解很差。我将尝试尽可能清楚地解释我的问题:我想使用 mxgraph 将图像替换为新图像。有没有办法用 mxgraph 做到这一点?我试过graph.setCellStyles函数,或者这样:

mxGraph.prototype.getImage = function(state)
{
  if (state != null && state.style != null)
  {
    return state.style[mxConstants.STYLE_IMAGE];
  }
  return null;
}

但它不起作用。提前谢谢你。

【问题讨论】:

    标签: javascript mxgraph


    【解决方案1】:

    Java 解决方案:

    graph.getView().getState(cell).getStyle().replace(mxConstants.STYLE_IMAGE, new ImageIcon( GraphViewer.class.getResource("/com/mxgraph/examples/swing/images/cube_green.png")));
    

    【讨论】:

      猜你喜欢
      • 2019-02-28
      • 2016-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-10
      • 2021-11-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多