/** Sends a figure to the back of the drawing. */ public synchronized void sendToBack(Figure figure) { if (fFigures.contains(figure)) { fFigures.removeElement(figure); fFigures.insertElementAt(figure, 0); figure.changed(); } }
/** Brings a figure to the front. */ public synchronized void bringToFront(Figure figure) { if (fFigures.contains(figure)) { fFigures.removeElement(figure); fFigures.addElement(figure); figure.changed(); } }
/** Replaces a figure in the drawing without removing it from the drawing. */ public synchronized void replace(Figure figure, Figure replacement) { int index = fFigures.indexOf(figure); if (index != -1) { replacement.addToContainer(this); // will invalidate figure figure.changed(); fFigures.setElementAt(replacement, index); } }