int index = __windowsStack.indexOf(w);
if (!wasPartVisible(index)) {
Toolkit.endPainting();
return;
}
Rectangle rect = w.getRectangle();
if (w.hasShadow()) {
rect = ((Rectangle)rect.clone());
rect.resize(rect.getWidth()+1, rect.getHeight()+1);
}
Toolkit.drawRectangle(rect, getScreenColors());
for (int i=0; i<index; i++) {
Window aw = __windowsStack.get(i);
if (aw.isVisible()) {
Rectangle rect2 = aw.getRectangle();
if (aw.hasShadow()) {
rect2 = ((Rectangle)rect2.clone());
rect2.resize(rect2.getWidth()+1, rect2.getHeight()+1);
}
Rectangle clipRect = rect.intersection(rect2);
if ((!clipRect.isEmpty()) && (isToBeRepainted(clipRect, i,index))) {
Toolkit.setClipRectangle(clipRect);
aw.repaint();
Toolkit.unsetClipRectangle();
}
}