public void setLocationRelativeTo(Component c)
Sets the location of the window relative to the specified component.
If the component is not currently showing, or c is null, the window is placed at the center of the screen. The center point can be determined with GraphicsEnvironment.getCenterPoint
If the bottom of the component is offscreen, the window is placed to the side of the Component that is closest to the center of the screen.
So if the Component is on the right part of the screen, the Window is placed to its left, and visa versa.
Parameters:
c - the component in relation to which the window's location is determined
Partager