Class WBorderLayout

All Implemented Interfaces:

public class WBorderLayout extends WLayout
A layout manager which divides the container region in five regions.

The five regions are composed of:

 |              North               |
 |      |                    |      |
 | West |       Center       | East |
 |      |                    |      |
 |              South               |

Each region may hold no more than one widget, and for all but the Center region, the widget is optional.

The North, West, East, and South widgets will take their preferred sizes, while the Center widget takes all available remaining space.

  • Constructor Details

    • WBorderLayout

      public WBorderLayout()
      Creates a new border layout.
  • Method Details

    • setSpacing

      public void setSpacing(int size)
      Sets spacing between each item.

      The default spacing is 6 pixels.

    • getSpacing

      public int getSpacing()
      Returns the spacing between each item.

      See Also:
    • addItem

      public void addItem(WLayoutItem item)
      Description copied from class: WLayout
      Adds a layout item.

      The item may be a widget or nested layout.

      How the item is layed out with respect to siblings is implementation specific to the layout manager. In some cases, a layout manager will overload this method with extra arguments that specify layout options.

      Specified by:
      addItem in class WLayout
      See Also:
    • removeItem

      public WLayoutItem removeItem(WLayoutItem item)
      Description copied from class: WLayout
      Removes a layout item (widget or nested layout).

      Specified by:
      removeItem in class WLayout
      See Also:
    • getItemAt

      public WLayoutItem getItemAt(int index)
      Description copied from class: WLayout
      Returns the layout item at a specific index.

      If there is no item at the index, null is returned.

      Specified by:
      getItemAt in class WLayout
      See Also:
    • getCount

      public int getCount()
      Description copied from class: WLayout
      Returns the number of items in this layout.

      This may be a theoretical number, which is greater than the actual number of items. It can be used to iterate over the items in the layout, in conjunction with getItemAt().

      Specified by:
      getCount in class WLayout
    • addWidget

      public void addWidget(WWidget w, LayoutPosition position)
      Adds a widget to the given position.

      Only one widget per position is supported.

    • add

      public void add(WLayoutItem item, LayoutPosition position)
      Adds a layout item to the given position.

      Only one widget per position is supported.

    • widgetAt

      public WWidget widgetAt(LayoutPosition position)
      Returns the widget at a position.

      Returns null if no widget was set for that position.

    • getItemAt

      public WLayoutItem getItemAt(LayoutPosition position)
      Returns the item at a position.

      Returns null if no item was set for that position.

    • getPosition

      public LayoutPosition getPosition(WLayoutItem item)
      Returns the position at which the given layout item is set.
    • iterateWidgets

      public void iterateWidgets(HandleWidgetMethod method)
    • setParentWidget

      public void setParentWidget(WWidget parent)
      Description copied from interface: WLayoutItem
      Internal method.
      Specified by:
      setParentWidget in interface WLayoutItem
      setParentWidget in class WLayout