Example usage for java.awt Component setLocation

List of usage examples for java.awt Component setLocation

Introduction

In this page you can find the example usage for java.awt Component setLocation.

Prototype

public void setLocation(Point p) 

Source Link

Document

Moves this component to a new location.

Usage

From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java

/**
 * Shows the specified window on the screen, It will appear at the specified
 * location. If the location is <code>null</code>, it will appear in the 
 * middle of the screen. //  w  w  w.j av a2s . c o m
 * 
 * @param window   The component to show.
 * @param location   The location of the specified component if 
 *                <code>null</code> it will appear in the middle of the 
 *                screen.
 */
public static void showOnScreen(Component window, Point location) {
    if (window == null)
        return;
    if (location == null)
        centerOnScreen(window);
    else {
        window.setLocation(location);
        window.setVisible(true);
    }
}