void function ( Graphics arg0 , Color arg1 ) { assert ( composedTextLayout != null ) ; Point loc0 = getCaretLocation ( ) ; refillComposedArea ( arg1 , loc0 . x , loc0 . y ) ; composedTextLayout . draw ( ( Graphics2D ) arg0 , loc0 . x , loc0 . y ) ; }
draw text via input method with composed text information . this method can draw texts with some underlines to illustrate converting characters . this method is workaround for textareapainter . because , textareapainter ca n't treat attributedcharacteriterator directly . attributedcharacteriterator has very important information when composing text . it has a map where are converted characters and committed characters . ideally , changing textareapainter method can treat attributedcharacteriterator is better . but it 's very tough !! so i choose to write some code as a workaround . this draw method is proceeded with the following steps . 1 . original textareapainter draws characters . 2 . this refillcomposedarea method erase previous paint characters by textarea 's background color . the refill area is only square that width and height defined by characters with input method . 3 . compositiontextpainter.draw method paints composed text . it was actually drawn by textlayout . concode_field_sep int composedBeginCaretPosition concode_elem_sep TextLayout composedTextLayout concode_elem_sep JEditTextArea textArea concode_field_sep void invalidateComposedTextLayout concode_elem_sep void refillComposedArea concode_elem_sep void setComposedTextLayout concode_elem_sep boolean hasComposedTextLayout concode_elem_sep Point getCaretLocation