Skip to content
Juuxel edited this page Jul 17, 2020 · 4 revisions

Panels are widgets that contain other widgets. All panels in LibGui extend the WPanel class, which defines basic implementations for input events and rendering.

Root panels

Each GuiDescription has a root panel that stores all widgets. By default, that root panel is a WGridPanel, a slot-sized grid that you can add widgets to.

Root panels have the VANILLA background painter by default, making them look like vanilla GUI panels. This can be changed by overriding GuiDescription.addPainters and setting the background painter yourself.

The root panel itself can be changed with a call to GuiDescription.setRootPanel. This can be useful if you want something other than a grid panel of 18x18 slots.

Types of panels

There are three main types of panels: grid panels, plain panels and boxes.

Grid panels (WGridPanel)

Grid panels store widgets in a grid of squares. The size of each cell is 18 pixels by default, as it is also the size of one item slot.

You can also create a grid panel with a custom grid size. For example, new WGridPanel(9) would create a panel with half-slot cells. The new panel can be set as the root panel of your GUI with GuiDescription.setRootPanel.

TODO: Usage examples

Plain panels (WPlainPanel)

Plain panels place widgets pixel-perfectly. This is useful is you have a background texture or a complex layout for your GUI.

TODO: Add usage example

Boxes (WBox)

TODO: Add documentation for boxes