From dd3de15d315f7ba77194cad1c37d69c5d28e4944 Mon Sep 17 00:00:00 2001 From: Jonathan Feinberg Date: Sun, 8 Jun 2014 22:27:26 -0400 Subject: [PATCH] Permit modes to enhance the text editor by adding their own typographical effects to the Painter. This permits Python mode to draw an indentation indicator, which is common in Python editors. --- app/src/processing/app/syntax/JEditTextArea.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java index de7eb16ce..221218d46 100644 --- a/app/src/processing/app/syntax/JEditTextArea.java +++ b/app/src/processing/app/syntax/JEditTextArea.java @@ -103,7 +103,7 @@ public class JEditTextArea extends JComponent } // Initialize some misc. stuff - painter = new TextAreaPainter(this, defaults); + painter = createPainter(defaults); documentHandler = new DocumentHandler(); eventListenerList = new EventListenerList(); caretEvent = new MutableCaretEvent(); @@ -176,6 +176,16 @@ public class JEditTextArea extends JComponent } + /** + * Override this to provide your own painter for this {@link JEditTextArea}. + * @param defaults + * @return a newly constructed {@link TextAreaPainter}. + */ + protected TextAreaPainter createPainter(final TextAreaDefaults defaults) { + return new TextAreaPainter(this, defaults); + } + + /** * Inline Input Method Support for Japanese. */