Caret caret = component.getCaret();
if (component.isOpaque()) {
paintBackground(g);
}
if (highlighter != null) {
highlighter.paint(g);
}
Rectangle visibleRect = getVisibleEditorRect();
if (visibleRect != null) {
getRootView().setSize(visibleRect.width, visibleRect.height);
getRootView().paint(g, visibleRect);