本文整理了Java中java.awt.Window.requestFocus()
方法的一些代码示例,展示了Window.requestFocus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.requestFocus()
方法的具体详情如下:
包路径:java.awt.Window
类名称:Window
方法名:requestFocus
暂无
代码示例来源:origin: org.japura/japura-gui
public static void requestWindowFocus(Component component) {
if (component != null) {
Window window = GUIUtils.getWindowAncestor(component);
if (window != null) {
window.requestFocus();
}
}
}
代码示例来源:origin: igvteam/igv
/**
* Method description
*
* @param window
*/
public static void centerWindow(Window window) {
Dimension dimension = window.getSize();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int x = (screenSize.width - dimension.width) / 2;
int y = (screenSize.height - dimension.height) / 2;
window.setLocation(x, y);
window.requestFocus();
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf
/**
* Description of the Method
*
* @param target Description of Parameter
*/
public void attachSnapTo(Window target) {
synchronized (snaps) {
// notify the listener that it should not handle the next windowActivateEvent
ignoreEvents = true;
for (int i = 0, c = snaps.size(); i < c; i++) {
((Snap) snaps.elementAt(i)).attachTo(target);
}
// restore focus to target
target.requestFocus();
target.toFront();
}
}
}
代码示例来源:origin: com.github.lgooddatepicker/LGoodDatePicker
/**
* windowLostFocus, Part of WindowFocusListener. Whenever the popup window loses focus, it will
* be hidden.
*/
@Override
public void windowLostFocus(WindowEvent e) {
// This section is part of the bug fix for blank popup windows in linux.
if (!enableHideWhenFocusIsLost) {
e.getWindow().requestFocus();
return;
}
// This fixes a linux-specific behavior where the focus can be "lost" by clicking a child
// component (inside the same panel!).
if (InternalUtilities.isMouseWithinComponent(displayWindow)) {
return;
}
hide();
}
代码示例来源:origin: jawi/ols
@Override
public void run()
{
final Window window = findWindow( getValue( NAME ) );
if ( ( window != null ) && !SwingComponentUtils.isActivelyShown( window ) )
{
if ( window instanceof Frame )
{
deiconifyWindow( ( Frame )window );
}
window.toFront();
window.requestFocus();
}
}
} );
代码示例来源:origin: freeplane/freeplane
private void toFront() {
final Component menuComponent = UITools.getMenuComponent();
if(menuComponent instanceof Frame) {
final Frame frame = (Frame) menuComponent;
final int state = frame.getExtendedState();
if ((state & Frame.ICONIFIED) != 0)
frame.setExtendedState(state & ~Frame.ICONIFIED);
}
if(menuComponent instanceof Window) {
Window window = (Window) menuComponent;
if (!window.isVisible())
window.setVisible(true);
window.toFront();
window.requestFocus();
}
}
代码示例来源:origin: com.fifesoft.rtext/fife.common
focused.requestFocus();
代码示例来源:origin: org.scijava/j3dcore
windowParent.requestFocus();
内容来源于网络,如有侵权,请联系作者删除!