Package org.gvsig.utils.centerComponent
Class CenterComponent
java.lang.Object
org.gvsig.utils.centerComponent.CenterComponent
Allows center a component (Ex. JInternalFrame, JFrame, etc.) respect its parent component
Exceptions:
- If the component is a JDialog -> better use:
jDialog.setLocationRelativeTo(parentComponent); - If the component is a JFrame or a JWindow -> better use:
jFrame.setSize(width, height);
jFrame.setLocationRelativeTo(null);
or
jWindow.setSize(width, height);
jWindow.setLocationRelativeTo(null);
- Author:
- Pablo Piqueras Bartolomé (p_queras@hotmail.com)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcenterComponent(Component component, Rectangle parentBounds) Centers a component (Ex.
-
Constructor Details
-
CenterComponent
public CenterComponent()
-
-
Method Details
-
centerComponent
Centers a component (Ex. JInternalFrame, JFrame, etc.) according its size and the bounds of its parent
Exceptions:
- If the component is a JDialog -> better use:
jDialog.setLocationRelativeTo(parentComponent); - If the component is a JFrame or a JWindow -> better use:
jFrame.setSize(width, height);
jFrame.setLocationRelativeTo(null);
or
jWindow.setSize(width, height);
jWindow.setLocationRelativeTo(null);
- Parameters:
component- The component to centerparentBounds- Bounds of the parent of the component.
- If the component is a JDialog -> better use:
-