- All Known Implementing Classes:
AbsoluteLayout
,BorderLayout
,GridLayout
,LinearLayout
,SplitPanel.ScrollPanelLayoutManager
public interface LayoutManager
A layout manager is a class that takes an area of usable space and a list of components to fit on that space. This
is very similar to how AWT/Swing/SWT works. Lanterna contains a number of layout managers built-in that will arrange
components in various ways, but you can also write your own. The typical way of providing customization and tuning,
so the layout manager can distinguish between components and treat them in different ways, is to create a class
and/or objects based on the
LayoutData
object, which can be assigned to each Component
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
doLayout
(TerminalSize area, 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.getPreferredSize
(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.boolean
Returns true if the internal state of this LayoutManager has changed since the last call to doLayout.
-
Method Details
-
getPreferredSize
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.- Parameters:
components
- List of components- Returns:
- Size the layout manager would like to have
-
doLayout
Given 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.- Parameters:
area
- Size available to this layout manager to lay out the components oncomponents
- List of components to lay out
-
hasChanged
boolean hasChanged()Returns 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.- Returns:
true
if this layout manager's internal state has changed since the last call todoLayout
-