This avoids an endless look in JViewport.setView().

2005-10-17  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/JViewport.java
        (setView): Removed unnecessary loop. We only have on component.
        (isOptimizedDrawingEnabled): Added comment explaining why this
        method is necessary.


/Roman
Index: javax/swing/JViewport.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JViewport.java,v
retrieving revision 1.30
diff -u -r1.30 JViewport.java
--- javax/swing/JViewport.java	12 Oct 2005 15:29:48 -0000	1.30
+++ javax/swing/JViewport.java	17 Oct 2005 13:44:50 -0000
@@ -142,6 +142,7 @@
      */
     protected ViewListener()
     {
+      // Nothing to do here.
     }
 
     /**
@@ -398,12 +399,8 @@
 
   public void setView(Component v)
   {
-    while (getComponentCount() > 0)
-      {
-        if (viewListener != null)
-          getView().removeComponentListener(viewListener);
-        //remove(0);
-      }
+    if (viewListener != null)
+      getView().removeComponentListener(viewListener);
 
     if (v != null)
       {
@@ -456,6 +453,14 @@
     return insets;
   }
     
+
+  /**
+   * Overridden to return <code>false</code>, so the JViewport's paint method
+   * gets called instead of directly calling the children. This is necessary
+   * in order to get a useful clipping and translation on the children.
+   *
+   * @return <code>false</code>
+   */
   public boolean isOptimizedDrawingEnabled()
   {
     return false;
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to