src/share/classes/sun/awt/LightweightFrame.java
Print this page
*** 29,38 ****
--- 29,39 ----
import java.awt.Frame;
import java.awt.Graphics;
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;
/**
* The class provides basic functionality for a lightweight frame
*** 122,127 ****
--- 123,172 ----
* The method is called by the AWT grab machinery.
*
* @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;
+ }
}