本文整理汇总了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;
}