private void fireMouseMotionEvent(MouseEvent e) {
        TextMouseEvent textMouseEvent = null;
        Object[] listeners = listenerList.getListenerList();
        for (int i = listeners.length - 2; i >= 0; i -= 2) {
            if (listeners[i] == TextMouseMotionListener.class) {
                if (textMouseEvent == null)
                    textMouseEvent = createTextMouseEvent(e);
                
                TextMouseMotionListener listener = ((TextMouseMotionListener) listeners[i + 1]);
                switch (e.getID()) {
                    case MouseEvent.MOUSE_MOVED:    listener.mouseMoved(textMouseEvent);     break;
                    case MouseEvent.MOUSE_DRAGGED:  listener.mouseDragged(textMouseEvent);   break;
                }
            }
        }
    }