I need to replace one Canvas by another. I suppose it should be:
Maybe I don't understand something?
The solution for me is:
But I sure there is better way to do it...
Code:
public static void replaceCanvas(Canvas oldCanvas, Canvas newCanvas){ oldCanvas = newCanvas; }
The solution for me is:
Code:
public static void replaceCanvas(Canvas oldCanvas, Canvas newCanvas){ Layout parent = (Layout) oldCanvas.getParentElement(); Canvas[] children = parent.getMembers(); //another challenge - get position of member int pos = getPos(parent, oldCanvas); children[pos].destroy(); children[pos] = newCanvas; parent.setMembers(children); parent.redraw(); }