- java.lang.Object
-
- com.googlecode.lanterna.gui2.BorderLayout
-
- All Implemented Interfaces:
LayoutManager
public class BorderLayout extends java.lang.Object implements LayoutManager
BorderLayout imitates the BorderLayout class from AWT, allowing you to add a center component with optional components around it in top, bottom, left and right locations. The edge components will be sized at their preferred size and the center component will take up whatever remains.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBorderLayout.LocationThis type is what you use as the layout data for components added to a panel usingBorderLayoutfor its layout manager.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<BorderLayout.Location>AUTO_ASSIGN_ORDER
-
Constructor Summary
Constructors Constructor Description BorderLayout()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoLayout(TerminalSize area, java.util.List<Component> components)Given a size constraint, update the location and size of each component in the component list by laying them out in the available area.TerminalSizegetPreferredSize(java.util.List<Component> components)This method returns the dimensions it would prefer to have to be able to layout all components while giving all of them as much space as they are asking for.booleanhasChanged()Returns true if the internal state of this LayoutManager has changed since the last call to doLayout.private java.util.EnumMap<BorderLayout.Location,Component>makeLookupMap(java.util.List<Component> components)
-
-
-
Field Detail
-
AUTO_ASSIGN_ORDER
private static final java.util.List<BorderLayout.Location> AUTO_ASSIGN_ORDER
-
-
Method Detail
-
getPreferredSize
public TerminalSize getPreferredSize(java.util.List<Component> components)
Description copied from interface:LayoutManagerThis method returns the dimensions it would prefer to have to be able to layout all components while giving all of them as much space as they are asking for.- Specified by:
getPreferredSizein interfaceLayoutManager- Parameters:
components- List of components- Returns:
- Size the layout manager would like to have
-
doLayout
public void doLayout(TerminalSize area, java.util.List<Component> components)
Description copied from interface:LayoutManagerGiven a size constraint, update the location and size of each component in the component list by laying them out in the available area. This method will callsetPosition(..)andsetSize(..)on the Components.- Specified by:
doLayoutin interfaceLayoutManager- Parameters:
area- Size available to this layout manager to lay out the components oncomponents- List of components to lay out
-
makeLookupMap
private java.util.EnumMap<BorderLayout.Location,Component> makeLookupMap(java.util.List<Component> components)
-
hasChanged
public boolean hasChanged()
Description copied from interface:LayoutManagerReturns true if the internal state of this LayoutManager has changed since the last call to doLayout. This will tell the container that it needs to call doLayout again.- Specified by:
hasChangedin interfaceLayoutManager- Returns:
trueif this layout manager's internal state has changed since the last call todoLayout
-
-