You can use CodeArea to highlight errors.
CodeArea codeArea = new CodeArea();
codeArea.textProperty().addListener((observable, oldText, newText) -> {
List<IndexRange> errors = spellCheck(newText);
for(IndexRange error: errors) {
codeArea.setStyleClass(error.getStart(), error.getEnd(), "spell-error");
}
});
List<IndexRange> spellCheck(String text) {
}
Also, set the error style in the stylesheet.
.spell-error {
-fx-effect: dropshadow(gaussian, red, 2, 0, 0, 0);
}
Please note that you need JDK8 to use CodeArea.
source
share