summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2006-06-15 13:32:45 +0000
committerRoman Kennke <roman@kennke.org>2006-06-15 13:32:45 +0000
commit099cd680ffa509e660bfa63029c8f9f5ecf7ae41 (patch)
treedb592da3adc95e7e2a231b58f220fb129828c528
parent4bd3972e0d70cd15a6114d644f84801836c19df5 (diff)
downloadclasspath-099cd680ffa509e660bfa63029c8f9f5ecf7ae41.tar.gz
2006-06-15 Roman Kennke <kennke@aicas.com>
PR 28027 * javax/swing/JComponent.java (paintImmediately2): Only paint component without double buffering when all of it's parents have also double buffering disabled. (isPaintingDoubleBuffered): New helper method.
-rw-r--r--ChangeLog8
-rw-r--r--javax/swing/JComponent.java22
2 files changed, 29 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 10bfbfd8c..36f310e94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-06-15 Roman Kennke <kennke@aicas.com>
+
+ PR 28027
+ * javax/swing/JComponent.java
+ (paintImmediately2): Only paint component without double buffering
+ when all of it's parents have also double buffering disabled.
+ (isPaintingDoubleBuffered): New helper method.
+
2006-06-15 David Gilbert <david.gilbert@object-refinery.com>
* gnu/java/awt/peer/gtk/CairoGraphics2D.java
diff --git a/javax/swing/JComponent.java b/javax/swing/JComponent.java
index bb2326d69..67cd01c35 100644
--- a/javax/swing/JComponent.java
+++ b/javax/swing/JComponent.java
@@ -2139,7 +2139,7 @@ public abstract class JComponent extends Container implements Serializable
{
isRepainting = true;
RepaintManager rm = RepaintManager.currentManager(this);
- if (rm.isDoubleBufferingEnabled() && isDoubleBuffered())
+ if (rm.isDoubleBufferingEnabled() && isPaintingDoubleBuffered())
paintDoubleBuffered(r);
else
paintSimple(r);
@@ -2147,6 +2147,26 @@ public abstract class JComponent extends Container implements Serializable
}
/**
+ * Returns true if we must paint double buffered, that is, when this
+ * component or any of it's ancestors are double buffered.
+ *
+ * @return true if we must paint double buffered, that is, when this
+ * component or any of it's ancestors are double buffered
+ */
+ private boolean isPaintingDoubleBuffered()
+ {
+ boolean doubleBuffered = isDoubleBuffered();
+ Component parent = getParent();
+ while (! doubleBuffered && parent != null)
+ {
+ doubleBuffered = parent instanceof JComponent
+ && ((JComponent) parent).isDoubleBuffered();
+ parent = parent.getParent();
+ }
+ return doubleBuffered;
+ }
+
+ /**
* Performs double buffered repainting.
*/
private void paintDoubleBuffered(Rectangle r)