首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何用mxgraph替换图像

如何用mxgraph替换图像
EN

Stack Overflow用户
提问于 2019-03-05 21:44:59
回答 1查看 176关注 0票数 4

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

代码语言:javascript
复制
mxGraph.prototype.getImage = function(state)
{
  if (state != null && state.style != null)
  {
    return state.style[mxConstants.STYLE_IMAGE];
  }
  return null;
}

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

EN

回答 1

Stack Overflow用户

发布于 2020-09-22 15:58:47

Java解决方案:

代码语言:javascript
复制
graph.getView().getState(cell).getStyle().replace(mxConstants.STYLE_IMAGE, new ImageIcon( GraphViewer.class.getResource("/com/mxgraph/examples/swing/images/cube_green.png")));
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55004298

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档