I found some loops in the revalidate and repaint mechanism in Swing.
This patch fixes one of them.
The problem is that we can easily create infinite loops with the
RepaintManager, if you call repaint() and/or revalidate inside the scope
of the paint() or LayoutManager methods. Therefore I advice everybody
who works on Swing to elaborate carefully before placing a repaint() or
revalidate() somewhere. Especially revalidate calls can be very
resource-consuming and are rarely necessary (only when the actual size
of a component changes). I will send some follow-up patches that remove
some more of this stuff.
2005-06-30 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/plaf/basic/BasicScrollBarUI.java:
Removed all calls to layoutContainer() in this file.
(installDefaults): Set this as LayoutManager for the JScrollBar.
This way the layoutContainer() method is called when it should
be.
/Roman
Index: javax/swing/plaf/basic/BasicScrollBarUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,v
retrieving revision 1.19
diff -u -r1.19 BasicScrollBarUI.java
--- javax/swing/plaf/basic/BasicScrollBarUI.java 27 Apr 2005 12:39:08 -0000 1.19
+++ javax/swing/plaf/basic/BasicScrollBarUI.java 30 Jun 2005 19:57:07 -0000
@@ -124,7 +124,6 @@
{
// System.err.println(this + ".stateChanged()");
calculatePreferredSize();
- layoutContainer(scrollbar);
getThumbBounds();
scrollbar.repaint();
}
@@ -167,9 +166,7 @@
incrButton.addMouseListener(buttonListener);
decrButton.addMouseListener(buttonListener);
calculatePreferredSize();
- layoutContainer(scrollbar);
}
- layoutContainer(scrollbar);
scrollbar.repaint();
}
}
@@ -820,6 +817,7 @@
scrollbar.setBackground(defaults.getColor("ScrollBar.background"));
scrollbar.setBorder(defaults.getBorder("ScrollBar.border"));
scrollbar.setOpaque(true);
+ scrollbar.setLayout(this);
thumbColor = defaults.getColor("ScrollBar.thumb");
thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow");
@@ -888,7 +886,6 @@
installListeners();
calculatePreferredSize();
- layoutContainer(scrollbar);
}
}
@@ -973,7 +970,6 @@
*/
public void paint(Graphics g, JComponent c)
{
- layoutContainer(scrollbar);
paintTrack(g, c, getTrackBounds());
paintThumb(g, c, getThumbBounds());
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches