Example usage for java.awt Window getFocusableWindowState

List of usage examples for java.awt Window getFocusableWindowState

Introduction

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

Prototype

public boolean getFocusableWindowState() 

Source Link

Document

Returns whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow .

Usage

From source file:org.eclipse.wb.internal.swing.utils.SwingImageUtils.java

/**
 * Prepares {@link Component} for printing.
 * //from ww w.j  a v a2  s  .c  om
 * mitin_aa: Linux: for Metacity window manager (as recommended to use with the Designer) to
 * prevent preview window flickering a better place for preview window is right-bottom screen
 * direction.
 * 
 * TODO: add a preference (Linux only) allowing the user to explicitly set preview window location
 */
public static void prepareForPrinting(Component component) throws Exception {
    component.setLocation(10000, 10000);
    // don't grab focus during printing
    if (component instanceof Window) {
        Window window = (Window) component;
        m_fosucableStates.put(window, window.getFocusableWindowState());
        window.setFocusableWindowState(false);
    }
    // make visible
    setVisible(component, true);
    {
        // workaround to prevent window from flashing if the Window Manager 
        // doesn't allow the window to appear off-screen. 
        if (component instanceof Window) {
            Window window = (Window) component;
            window.toBack();
            // do the location change once again, because sometimes setLocation() 
            // for invisible windows could be ignored.
            component.setLocation(10000, 10000);
        }
    }
}