private void stopEditing() {
if (captionEditor.isVisible()) {
String text = captionEditor.getText();
Label label = captionEditor.getLabel();
DrawingContext drawCtx = prepareDrawingContext(getGraphics());
SetLabelTextCommand command = new SetLabelTextCommand(label, text,
drawCtx);
execute(command);
captionEditor.hideEditor();
repaint();
}