Fixed window insets and layouting in the face of the ProxyWindow subsystem.
--- a/src/share/classes/sun/awt/peer/cacio/CacioComponentPeer.java Fri May 15 23:03:55 2009 +0200
+++ b/src/share/classes/sun/awt/peer/cacio/CacioComponentPeer.java Tue May 19 09:18:57 2009 +0200
@@ -556,7 +556,15 @@ class CacioComponentPeer<AWTComponentTyp
// different bounds.
proxy.setBounds(awtComponent.getX(), awtComponent.getY(),
awtComponent.getWidth(), awtComponent.getHeight());
- proxy.validate();
+ }
+ if (swingComponent != null) {
+ // The swing component is laid out relative to the proxy window.
+ // That's why it starts at (0, 0).
+ swingComponent.setBounds(0, 0, width, height);
+ // We need to validate the swing component after resizing,
+ // otherwise complex components (e.g. JScrollPane, etc) are not
+ // laid out correctly.
+ swingComponent.validate();
}
}
@@ -693,6 +701,10 @@ class CacioComponentPeer<AWTComponentTyp
return swingComponent;
}
+ ProxyWindow getProxyWindow() {
+ return proxy;
+ }
+
@Override
public void setZOrder(ComponentPeer above) {
--- a/src/share/classes/sun/awt/peer/cacio/CacioWindowPeer.java Fri May 15 23:03:55 2009 +0200
+++ b/src/share/classes/sun/awt/peer/cacio/CacioWindowPeer.java Tue May 19 09:18:57 2009 +0200
@@ -156,8 +156,12 @@ class CacioWindowPeer extends CacioConta
if (rp == null) {
return new Insets(0, 0, 0, 0);
}
- if (! rp.isValid()) {
- rp.validate();
+ // Need to make the proxy visible, otherwise the root pane is
+ // not laid out. Making the proxy visible has no effect as
+ // as long as the platform window is hidden.
+ ProxyWindow proxy = getProxyWindow();
+ if (! proxy.isVisible()) {
+ proxy.setVisible(true);
}
Component cp = rp.getContentPane();
Rectangle cpBounds = cp.getBounds();