.. default-domain:: java .. highlight:: java .. package:: krpc.client.services.UI Layout ====== .. type:: public class Layout Arranges the elements of a panel automatically, so that they do not have to be positioned one by one. See :meth:`Panel.addHorizontalLayout()`, :meth:`Panel.addVerticalLayout()` and :meth:`Panel.addGridLayout()`. .. method:: float getSpacing() .. method:: void setSpacing(float value) The gap left between the elements, in pixels. A grid layout uses it in both directions. .. method:: Padding getPadding() .. method:: void setPadding(Padding value) The gap left inside the edges of the panel. .. method:: TextAnchor getChildAlignment() .. method:: void setChildAlignment(TextAnchor value) Where the elements are placed within the space the layout has to fill. .. method:: org.javatuples.Pair getCellSize() .. method:: void setCellSize(org.javatuples.Pair value) The size of each cell of a grid layout, in pixels. .. note:: Only applies to a grid layout. Throws an exception for the other layouts, whose elements are sized individually using their layout elements. .. method:: GridConstraint getConstraint() .. method:: void setConstraint(GridConstraint value) What fixes the shape of a grid layout. .. note:: Only applies to a grid layout. Throws an exception for the other layouts. .. method:: int getConstraintCount() .. method:: void setConstraintCount(int value) The number of columns or rows that :meth:`Layout.getConstraint()` fixes, ignored when the constraint is :meth:`GridConstraint.FLEXIBLE`. .. note:: Only applies to a grid layout. Throws an exception for the other layouts. .. type:: public class Padding The gap left inside each edge of a layout, in whole pixels. .. note:: See :meth:`Layout.getPadding()`. .. constructor:: public Padding(int left, int right, int top, int bottom) Construct a Padding from the values of its fields. .. method:: int getLeft() The gap inside the left edge. .. method:: int getRight() The gap inside the right edge. .. method:: int getTop() The gap inside the top edge. .. method:: int getBottom() The gap inside the bottom edge. .. type:: public enum GridConstraint What fixes the shape of a grid layout. .. field:: public GridConstraint FLEXIBLE Fit as many columns and rows as the size of the panel allows. .. field:: public GridConstraint FIXED_COLUMN_COUNT Use a fixed number of columns, and as many rows as are needed. .. field:: public GridConstraint FIXED_ROW_COUNT Use a fixed number of rows, and as many columns as are needed.