From 71d20578fb0e29320db198f814bbff1b7a67e9c9 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Wed, 20 Feb 2013 16:28:44 -0500 Subject: [PATCH] adding debug code to wrongly accuse the caret blinker of issue #1561 --- .../processing/app/syntax/JEditTextArea.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java index e7c91aa03..361f41def 100644 --- a/app/src/processing/app/syntax/JEditTextArea.java +++ b/app/src/processing/app/syntax/JEditTextArea.java @@ -78,6 +78,7 @@ public class JEditTextArea extends JComponent private InputMethodSupport inputMethodSupport = null; private Brackets bracketHelper = new Brackets(); + /** * Creates a new JEditTextArea with the specified settings. @@ -87,15 +88,17 @@ public class JEditTextArea extends JComponent // Enable the necessary events enableEvents(AWTEvent.KEY_EVENT_MASK); - caretTimer = new Timer(500, new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (hasFocus()) { - blinkCaret(); + if (!DISABLE_CARET) { + caretTimer = new Timer(500, new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (hasFocus()) { + blinkCaret(); + } } - } - }); //new CaretBlinker//new CaretBlinker()); - caretTimer.setInitialDelay(500); - caretTimer.start(); + }); + caretTimer.setInitialDelay(500); + caretTimer.start(); + } // Initialize some misc. stuff painter = new TextAreaPainter(this, defaults); @@ -1251,7 +1254,9 @@ public class JEditTextArea extends JComponent // When the user is typing, etc, we don't want the caret // to blink blink = true; - caretTimer.restart(); + if (!DISABLE_CARET) { + caretTimer.restart(); + } // Disable rectangle select if selection start = selection end if(selectionStart == selectionEnd) @@ -1903,7 +1908,9 @@ public class JEditTextArea extends JComponent super.removeNotify(); // if(focusedComponent == this) // focusedComponent = null; - caretTimer.stop(); + if (!DISABLE_CARET) { + caretTimer.stop(); + } } /** @@ -1952,6 +1959,7 @@ public class JEditTextArea extends JComponent // protected static JEditTextArea focusedComponent; protected Timer caretTimer; + private boolean DISABLE_CARET = false; protected TextAreaPainter painter;