boolean (Editor editor, Rectangle area) { Caret caret = editor.getCaretModel().getCurrentCaret(); VisualPosition caretVisualPosition = caret.getVisualPosition(); int caretY = editor.visualPositionToXY(caretVisualPosition).y; return caretY < area.y; }