diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java index 4c4443af..771dd5cd 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java @@ -1260,6 +1260,11 @@ public void showParagraphRegion(int paragraphIndex, Bounds region) { suspendVisibleParsWhile(() -> virtualFlow.show(paragraphIndex, region)); } + public void showParagraphAtCenter(int paragraphIndex) { + double offset = Math.floor( getHeight() / 2.0 ); + suspendVisibleParsWhile(() -> virtualFlow.showAtOffset(paragraphIndex,offset)); + } + @Override public void requestFollowCaret() { followCaretRequested = true;