changeset 4690:3fe2884e7f05

7130587: [macosx] Scrolling and painting issues with late invocation of setText Reviewed-by: anthony
author serb
date Thu, 26 Jan 2012 21:44:28 +0400
parents 36f7b80cdb5a
children 2e4258236920
files src/macosx/classes/sun/lwawt/LWTextAreaPeer.java src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Thu Jan 26 21:28:39 2012 +0400
+++ b/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Thu Jan 26 21:44:28 2012 +0400
@@ -107,7 +107,7 @@
             final boolean doScroll = pos >= area.getDocument().getLength()
                                      && area.getDocument().getLength() != 0;
             area.insert(text, pos);
-            pane.validate();
+            revalidate();
             if (doScroll) {
                 final JScrollBar vbar = pane.getVerticalScrollBar();
                 if (vbar != null) {
@@ -139,6 +139,7 @@
             final Document document = getTextComponent().getDocument();
             document.removeDocumentListener(this);
             getDelegate().getView().replaceRange(text, start, end);
+            revalidate();
             postEvent(new TextEvent(getTarget(), TextEvent.TEXT_VALUE_CHANGED));
             document.addDocumentListener(this);
         }
--- a/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Thu Jan 26 21:28:39 2012 +0400
+++ b/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Thu Jan 26 21:44:28 2012 +0400
@@ -121,6 +121,7 @@
             final Document document = getTextComponent().getDocument();
             document.removeDocumentListener(this);
             getTextComponent().setText(l);
+            revalidate();
             if (firstChangeSkipped) {
                 postEvent(new TextEvent(getTarget(),
                                         TextEvent.TEXT_VALUE_CHANGED));
@@ -179,11 +180,17 @@
         return getTarget().isFocusable();
     }
 
+    protected final void revalidate() {
+        synchronized (getDelegateLock()) {
+            getTextComponent().invalidate();
+            getDelegate().validate();
+        }
+    }
+
     private void sendTextEvent(final DocumentEvent e) {
         postEvent(new TextEvent(getTarget(), TextEvent.TEXT_VALUE_CHANGED));
         synchronized (getDelegateLock()) {
-            getDelegate().invalidate();
-            getDelegate().validate();
+            revalidate();
         }
     }