Example usage for java.awt Window requestFocusInWindow

List of usage examples for java.awt Window requestFocusInWindow

Introduction

In this page you can find the example usage for java.awt Window requestFocusInWindow.

Prototype

public boolean requestFocusInWindow() 

Source Link

Document

Requests that this Component get the input focus, if this Component's top-level ancestor is already the focused Window.

Usage

From source file:org.isatools.isacreatorconfigurator.configui.FieldInterface.java

private void showPopupInCenter(Window container) {
    Container parent = main;//from   w  w w .  j  a va  2  s .c om
    Point parentLocation = parent.getLocationOnScreen();

    Dimension parentSize = parent.getSize();

    int calcedXLoc = (parentLocation.x) + ((parentSize.width) / 2) - (container.getWidth() / 2);
    int calcedYLoc = (parentLocation.y) + ((parentSize.height) / 2) - (container.getHeight() / 2);

    container.setVisible(true);
    container.setLocation(calcedXLoc, calcedYLoc);
    container.toFront();
    container.requestFocusInWindow();
}