本文整理匯總了Java中java.awt.Window.getOwner方法的典型用法代碼示例。如果您正苦於以下問題:Java Window.getOwner方法的具體用法?Java Window.getOwner怎麽用?Java Window.getOwner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Window
的用法示例。
在下文中一共展示了Window.getOwner方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addWindowParents
import java.awt.Window; //導入方法依賴的package包/類
private JSONObject addWindowParents(JSONObject r, Window parent, JSONObject current) {
while (parent != null) {
if (!parent.getClass().getName().equals("javax.swing.SwingUtilities$SharedOwnerFrame")
&& !parent.getClass().getName().equals("javax.swing.Popup$HeavyWeightWindow") && parent.isVisible()) {
JSONObject pWindow = getContextJSONObject(parent);
if (r == null) {
r = pWindow;
}
if (current != null) {
current.put("container", pWindow);
}
current = pWindow;
}
parent = parent.getOwner();
}
return r;
}
示例2: centreOnScreen
import java.awt.Window; //導入方法依賴的package包/類
public static void centreOnScreen(Window window)
{
Window owner = window.getOwner();
// If the window has an owner, use the same graphics configuration so it
// will
// open on the same screen. Otherwise, grab the mouse pointer and work
// from there.
GraphicsConfiguration gc = owner != null ? owner.getGraphicsConfiguration() : MouseInfo.getPointerInfo()
.getDevice().getDefaultConfiguration();
if( gc != null )
{
window.setBounds(centre(getUsableScreenBounds(gc), window.getBounds()));
}
else
{
// Fall-back to letting Java do the work
window.setLocationRelativeTo(null);
}
}
示例3: findFocusedWindow
import java.awt.Window; //導入方法依賴的package包/類
/**
* @return Focused and showing Window or null.
*/
private Window findFocusedWindow() {
Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow();
while( null != w && !w.isShowing() ) {
w = w.getOwner();
}
return w;
}
示例4: getToplevelOwner
import java.awt.Window; //導入方法依賴的package包/類
/**
* Return the owning Frame for a given Window. Used in setFSWindow below
* to set the properties of the owning Frame when a Window goes
* into fullscreen mode.
*/
private Frame getToplevelOwner(Window w) {
Window owner = w;
while (owner != null) {
owner = owner.getOwner();
if (owner instanceof Frame) {
return (Frame) owner;
}
}
// could get here if passed Window is an owner-less Dialog
return null;
}