< prev index next >
src/share/classes/javax/swing/DefaultDesktopManager.java
Print this page
rev 1556 : 6794764: Translucent windows are completely repainted on every paint event, on Windows
6719382: Printing of AWT components on windows is not working
6726866: Repainting artifacts when resizing or dragging JInternalFrames in non-opaque toplevel
6683775: Painting artifacts is seen when panel is made setOpaque(false) for a translucent window
Reviewed-by: anthony, tdv, alexp
*** 32,41 ****
--- 32,44 ----
import javax.swing.border.Border;
import java.awt.event.ComponentListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
+ import sun.awt.AWTAccessor;
+ import sun.awt.SunToolkit;
+
/** This is an implementation of the <code>DesktopManager</code>.
* It currently implements the basic behaviors for managing
* <code>JInternalFrame</code>s in an arbitrary parent.
* <code>JInternalFrame</code>s that are not children of a
* <code>JDesktop</code> will use this component
*** 632,648 ****
((JInternalFrame)f).danger = false;
}
boolean floaterCollision = isFloaterCollision(previousBounds, currentBounds);
- // System.out.println(previousBounds);
JComponent parent = (JComponent)f.getParent();
Rectangle visBounds = previousBounds.intersection(desktopBounds);
- // System.out.println(previousBounds);
-
-
- // System.out.println(visBounds);
RepaintManager currentManager = RepaintManager.currentManager(f);
currentManager.beginPaint();
try {
--- 635,646 ----
*** 680,690 ****
dirtyRects = SwingUtilities.computeDifference(previousBounds,
currentBounds);
} else {
dirtyRects = new Rectangle[1];
dirtyRects[0] = previousBounds;
- // System.out.println("no intersection");
};
// Fix the damage
for (int i = 0; i < dirtyRects.length; i++) {
parent.paintImmediately(dirtyRects[i]);
--- 678,687 ----
*** 699,716 ****
dirtyRects[i].y += newY - previousBounds.y;
((JInternalFrame)f).isDragging = false;
parent.paintImmediately(dirtyRects[i]);
((JInternalFrame)f).isDragging = true;
-
- // System.out.println(dirtyRects[i]);
}
}
} finally {
currentManager.endPaint();
}
}
private boolean isFloaterCollision(Rectangle moveFrom, Rectangle moveTo) {
if (floatingItems.length == 0) {
// System.out.println("no floaters");
--- 696,721 ----
dirtyRects[i].y += newY - previousBounds.y;
((JInternalFrame)f).isDragging = false;
parent.paintImmediately(dirtyRects[i]);
((JInternalFrame)f).isDragging = true;
}
}
} finally {
currentManager.endPaint();
}
+
+ // update window if it's non-opaque
+ Window topLevel = SwingUtilities.getWindowAncestor(f);
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ if (!AWTAccessor.getWindowAccessor().isOpaque(topLevel) &&
+ (tk instanceof SunToolkit) &&
+ ((SunToolkit)tk).needUpdateWindow())
+ {
+ AWTAccessor.getWindowAccessor().updateWindow(topLevel);
+ }
}
private boolean isFloaterCollision(Rectangle moveFrom, Rectangle moveTo) {
if (floatingItems.length == 0) {
// System.out.println("no floaters");
< prev index next >