Panel

    Panel is a single-component container with a frame around the content. It has an optional caption and an icon which are handled by the panel itself, not its containing layout. The panel itself does not manage the caption of its contained component. You need to set the content with setContent().

    Panel has 100% width and undefined height by default. This corresponds with the default sizing of VerticalLayout, which is perhaps most commonly used as the content of a Panel. If the width or height of a panel is undefined, the content must have a corresponding undefined or fixed size in the same direction to avoid a sizing paradox.

    Java

    The resulting layout is shown in A Panel.

    A Panel

    Normally, if a panel has undefined size in a direction, as it has by default vertically, it will fit the size of the content and grow as the content grows. However, if it has a fixed or percentual size and its content becomes too big to fit in the content area, a scroll bar will appear for the particular direction. Scroll bars in a Panel are handled natively by the browser with the overflow: auto property in CSS.

    In the following example, we have a 300 pixels wide and very high Image component as the panel content.

    Java

    Panel with Scroll Bars

    Panel implements the Scrollable interface to allow programmatic scrolling. You can set the scroll position in pixels with setScrollTop() and setScrollLeft(). You can also get the scroll position set previously, but scrolling the panel in the browser does not update the scroll position to the server-side.

    CSS Style Rules

    CSS

    The built-in light style in the Reindeer and Runo themes has no borders or border decorations for the Panel. You can use the Reindeer.PANEL_LIGHT and Runo.PANEL_LIGHT constants to add the style to a panel. Other themes may also provide the light and other styles for Panel as well.