---
name: johannesrabauer/javafx-rich-text-documents-editors
source: https://app.decimal.ai/s/johannesrabauer-javafx-rich-text-documents-editors@1/SKILL.md
source_sha256: 805703961170
---

# JavaFX Rich Text, Documents, and Editors

Use this skill when the application behaves like an editor: document tabs, preview panes, annotation
surfaces, search, undo/redo, or export-oriented workflows.

## Example

```java
import javafx.geometry.Orientation;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.control.ToolBar;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.SplitPane;

public class EditorShell extends BorderPane {

    public EditorShell() {
        var files = new ListView<String>();
        files.getItems().addAll("notes.md", "draft.txt", "summary.adoc");

        var editor = new TextArea();
        var preview = new TextArea();
        preview.setEditable(false);

        editor.textProperty().addListener((obs, oldValue, newValue) -> preview.setText(newValue));

        var split = new SplitPane(editor, preview);
        split.setOrientation(Orientation.HORIZONTAL);

        setTop(new ToolBar());
        setLeft(files);
        setCenter(split);
    }
}
```

## Setup notes

- Plan for undo, selection, clipboard, file IO, and persistence from the beginning.
- Add libraries such as RichTextFX, RichTextArea, or PDF/document viewers only when the editing
  model truly requires them.
- Keep preview generation and document parsing off the FX thread.

## Gotchas

- Editor-style apps quickly need stable workspace state, not just a central text area.
- Annotation and diagram tools depend on hit-testing, transforms, and zoom behavior.
- Preview panes and export pipelines can hide expensive background work if they update too eagerly.