Module is.codion.swing.common.ui
Package is.codion.swing.common.ui.layout
Interface FlexibleGridLayout.Builder
- Enclosing class:
FlexibleGridLayout
public static interface FlexibleGridLayout.Builder
Builds a
FlexibleGridLayout instances.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newFlexibleGridLayoutinstance with the current configuration.columns(int columns) Sets the number of columns in the layout.fixColumnWidths(boolean fixColumnWidths) Enables or disables uniform column widths based on the widest component in each column.fixedColumnWidth(int fixedColumnWidth) Sets a specific fixed pixel width for all columns.fixedRowHeight(int fixedRowHeight) Sets a specific fixed pixel height for all rows.fixRowHeights(boolean fixRowHeights) Enables or disables uniform row heights based on the tallest component in each row.gap(int gap) Sets both the horizontal and vertical gap between components.growColumn(int index) Specifies a column absorbing the width a container has beyond the preferred one, and giving up the width it lacks, the other columns keeping their preferred width.growRow(int index) Specifies a row absorbing the height a container has beyond the preferred one, and giving up the height it lacks, the other rows keeping their preferred height.horizontalGap(int horizontalGap) Sets the horizontal gap between components.rows(int rows) Sets the number of rows in the layout.rowsColumns(int rows, int columns) Sets both the number of rows and columns.verticalGap(int verticalGap) Sets the vertical gap between components.
-
Method Details
-
rows
Sets the number of rows in the layout. If both rows and columns are zero, layout behavior is undefined.- Parameters:
rows- the number of rows- Returns:
- this builder instance
-
columns
Sets the number of columns in the layout. If both rows and columns are zero, layout behavior is undefined.- Parameters:
columns- the number of columns- Returns:
- this builder instance
-
rowsColumns
Sets both the number of rows and columns.- Parameters:
rows- the number of rowscolumns- the number of columns- Returns:
- this builder instance
-
gap
Sets both the horizontal and vertical gap between components.- Parameters:
gap- the number of pixels between components in both directions- Returns:
- this builder instance
-
horizontalGap
Sets the horizontal gap between components.- Parameters:
horizontalGap- the number of pixels between columns- Returns:
- this builder instance
-
verticalGap
Sets the vertical gap between components.- Parameters:
verticalGap- the number of pixels between rows- Returns:
- this builder instance
-
fixRowHeights
Enables or disables uniform row heights based on the tallest component in each row.- Parameters:
fixRowHeights- true to use fixed row heights- Returns:
- this builder instance
-
fixColumnWidths
Enables or disables uniform column widths based on the widest component in each column.- Parameters:
fixColumnWidths- true to use fixed column widths- Returns:
- this builder instance
-
fixedRowHeight
Sets a specific fixed pixel height for all rows. Automatically impliesfixRowHeights(boolean)with true.- Parameters:
fixedRowHeight- the fixed row height in pixels- Returns:
- this builder instance
-
fixedColumnWidth
Sets a specific fixed pixel width for all columns. Automatically impliesfixColumnWidths(boolean)with true.- Parameters:
fixedColumnWidth- the fixed column width in pixels- Returns:
- this builder instance
-
growRow
Specifies a row absorbing the height a container has beyond the preferred one, and giving up the height it lacks, the other rows keeping their preferred height. Call for each growing row.
By default the difference is divided equally between all rows, as it is when none of the rows specified exists.
- Parameters:
index- the index of the growing row- Returns:
- this builder instance
- Throws:
IllegalArgumentException- in case the index is negative
-
growColumn
Specifies a column absorbing the width a container has beyond the preferred one, and giving up the width it lacks, the other columns keeping their preferred width. Call for each growing column.
By default the difference is divided equally between all columns, as it is when none of the columns specified exists. A label column in a two column form typically keeps its preferred width:
FlexibleGridLayout.builder() .rows(0) .columns(2) .growColumn(1)// the input column takes the space the labels do not need .build();- Parameters:
index- the index of the growing column- Returns:
- this builder instance
- Throws:
IllegalArgumentException- in case the index is negative
-
build
FlexibleGridLayout build()Builds a newFlexibleGridLayoutinstance with the current configuration.- Returns:
- a configured layout manager
-