--- old/src/share/classes/sun/awt/LightweightFrame.java 2014-05-22 21:44:51.000000000 +0400 +++ new/src/share/classes/sun/awt/LightweightFrame.java 2014-05-22 21:44:51.000000000 +0400 @@ -31,6 +31,7 @@ import java.awt.Image; import java.awt.MenuBar; import java.awt.MenuComponent; +import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.peer.FramePeer; @@ -124,4 +125,48 @@ * @see SunToolkit#ungrab(java.awt.Window) */ public abstract void ungrabFocus(); + + /** + * Returns the scale factor of this frame. The default value is 1. + * + * @return the scale factor + * @see #notifyDisplayChanged(int) + */ + public abstract int getScaleFactor(); + + /** + * Called when display of the hosted frame is changed. + * + * @param scaleFactor the scale factor + */ + public abstract void notifyDisplayChanged(int scaleFactor); + + /** + * Host window absolute bounds. + */ + private int hostX, hostY, hostW, hostH; + + /** + * Returns the absolute bounds of the host (embedding) window. + * + * @return the host window bounds + */ + public Rectangle getHostBounds() { + if (hostX == 0 && hostY == 0 && hostW == 0 && hostH == 0) { + // The client app is probably unaware of the setHostBounds. + // A safe fall-back: + return getBounds(); + } + return new Rectangle(hostX, hostY, hostW, hostH); + } + + /** + * Sets the absolute bounds of the host (embedding) window. + */ + public void setHostBounds(int x, int y, int w, int h) { + hostX = x; + hostY = y; + hostW = w; + hostH = h; + } }