case MOVE_ROI: handleState(ROIAgt.MOVING, true); break; case SIZE_ROI: handleState(ROIAgt.RESIZING, false); break; case DRAW_ON_OFF: handleOnOffDrawing(e); break;
    public void actionPerformed(ActionEvent e)    {        int index = Integer.parseInt(e.getActionCommand());        try {            switch (index) {                case RECTANGLE:                    setType(ROIFactory.RECTANGLE, true); break;                case ELLIPSE:                    setType(ROIFactory.ELLIPSE, false); break;                case ERASE:                    control.erase(); break;                case ERASE_ALL:                    control.eraseAll(); break;                case MOVE_ROI:                    handleState(ROIAgt.MOVING, true); break;                case SIZE_ROI:                    handleState(ROIAgt.RESIZING, false); break;                case DRAW_ON_OFF:                    handleOnOffDrawing(e); break;                case TEXT_ON_OFF:                    handleOnOffText(e); break;                case ANNOTATION_ON_OFF:                    handleOnOffAnnotation(e); break;                    case COLOR:                    handleColor(e); break;                case CHANNEL:                    handleChannel(e); break;                case ANALYSE:                    control.analyse(); break;                case UNDO_ERASE:                    control.undoErase();            }        } catch(NumberFormatException nfe) {             throw new Error("Invalid Action ID "+index, nfe);         }    }