question: public void endComposition ( ) { if ( disposed ) { return ; } savedCompositionState = getCompositionState ( ) ; boolean active = haveActiveClient ( ) ; if ( active && composedText == null && committedText == null ) { needResetXIC = true ; needResetXICClient = new WeakReference < > ( getClientComponent ( ) ) ; return ; } String text = resetXIC ( ) ; if ( active ) { needResetXIC = false ; } awtLock ( ) ; composedText = null ; postInputMethodEvent ( InputMethodEvent . INPUT_METHOD_TEXT_CHANGED , null , 0 , null , null ) ; if ( text != null && text . length ( ) > 0 ) { dispatchCommittedText ( text ) ; } awtUnlock ( ) ; if ( savedCompositionState ) { resetCompositionState ( ) ; } }
target:  Ends any input composition that may currently be going on in this context. Depending on the platform and possibly user preferences, this may commit or delete uncommitted text. Any changes to the text are communicated to the active component using an input method event. <p> A text editing component may call this in a variety of situations, for example, when the user moves the insertion point within the text (but outside the composed text), or when the component's text is saved to a file or copied to the clipboard.