.. default-domain:: java .. highlight:: java .. package:: krpc.client.services.UI Panel ===== .. type:: public class Panel A container for user interface elements. Added to a :type:`Canvas` or another panel. | Base class: :type:`Container` .. container:: inherited-members .. rubric:: Inherited Members * From :type:`Container`: :meth:`addPanel `, :meth:`addText `, :meth:`addInputField `, :meth:`addButton `, :meth:`addToggle `, :meth:`addToggleGroup `, :meth:`addSlider `, :meth:`addDropdown `, :meth:`addImage `, :meth:`addScrollView ` * From :type:`Object`: :meth:`getRectTransform `, :meth:`getLayoutElement `, :meth:`getVisible `, :meth:`setVisible `, :meth:`remove ` .. method:: PanelStyle getStyle() .. method:: void setStyle(PanelStyle value) How the background of the panel is drawn. A box is the frame to group related controls in, and is how a group box is made. .. method:: StdLib.ColorRGBA getColor() .. method:: void setColor(StdLib.ColorRGBA value) The color the background of the panel is tinted with. .. note:: Has no effect while the style of the panel is :field:`PanelStyle.NONE`, as the panel is then not drawn at all. .. method:: boolean getDraggable() .. method:: void setDraggable(boolean value) Whether the user can move the panel by dragging it. .. note:: Dragging anywhere on the panel moves it, including over the elements it contains, unless one of them takes the pointer for itself. Give a panel a title bar of its own if only part of it should move it. A panel whose style is :field:`PanelStyle.NONE` is not drawn, so it takes no pointer events of its own and can only be dragged by the elements it contains. .. method:: Layout getLayout() The layout that arranges the elements of the panel, or ``null`` if they are positioned by hand. .. method:: Layout addHorizontalLayout() Arrange the elements of the panel in a row. .. method:: Layout addVerticalLayout() Arrange the elements of the panel in a column. .. method:: Layout addGridLayout() Arrange the elements of the panel in a grid of equally sized cells. .. note:: The number of columns follows from the size of the panel and the size of a cell. Use :meth:`Layout.getConstraint()` to fix it instead. .. method:: SizeFitter getSizeFitter() Sizes the panel to fit what it contains. .. note:: Both directions start out unconstrained, which leaves the size of the panel alone. .. method:: void bringToFront() Draw the panel in front of the other elements beside it. Elements are drawn in the order they were added, so of two overlapping panels the newer hides part of the older until the older is brought to the front. .. note:: A draggable panel also brings itself to the front when the user starts dragging it, the way a window comes to the front when it is clicked. .. type:: public enum PanelStyle How the background of a panel is drawn. .. field:: public PanelStyle WINDOW As a window, the heavier of the two frames the game uses. .. field:: public PanelStyle BOX As a box, the lighter frame the game groups related controls in. .. field:: public PanelStyle NONE Not drawn at all, leaving whatever is behind the panel showing through.