4

I am a new mxgraph user so my knowledge about mxgraph is very poor. I'll try to explain my problem as clear as possible: I want to replace an image with a new one using mxgraph. Is there a way to do that with mxgraph? I tried graph.setCellStyles function, or this way:

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

but it doesn't work. Thank you in advance.

adiga
  • 34,372
  • 9
  • 61
  • 83
A.Titta
  • 41
  • 2

1 Answers1

0

Java solution:

graph.getView().getState(cell).getStyle().replace(mxConstants.STYLE_IMAGE, new ImageIcon( GraphViewer.class.getResource("/com/mxgraph/examples/swing/images/cube_green.png")));
Khaled Alhayek
  • 553
  • 2
  • 6
  • 21