Class WGridPanel


public class WGridPanel extends WPanel
A panel that positions children in a grid.
  • Field Details

    • grid

      protected int grid
      The grid size in pixels. Defaults to 18, which is the size of one item slot.
  • Constructor Details

    • WGridPanel

      public WGridPanel()
      Constructs a grid panel with the default grid size.
    • WGridPanel

      public WGridPanel(int gridSize)
      Constructs a grid panel with a custom grid size.
      Parameters:
      gridSize - the grid size in pixels
  • Method Details

    • add

      public void add(WWidget w, int x, int y)
      Adds a widget to this panel.

      If the widget can be resized, it will be resized to (grid, grid).

      Parameters:
      w - the widget
      x - the X position in grid cells
      y - the Y position in grid cells
    • add

      public void add(WWidget w, int x, int y, int width, int height)
      Adds a widget to this panel and resizes it to a custom size.
      Parameters:
      w - the widget
      x - the X position in grid cells
      y - the Y position in grid cells
      width - the new width in grid cells
      height - the new height in grid cells
    • getInsets

      public Insets getInsets()
      Gets the layout insets of this panel.
      Returns:
      the insets
      Since:
      4.0.0
    • setInsets

      public WGridPanel setInsets(Insets insets)
      Sets the layout insets of this panel.

      The insets should be set before adding any widgets to this panel.

      Parameters:
      insets - the insets, should not be null
      Returns:
      this panel
      Since:
      4.0.0