Core concepts and layers
A Window manages the window, a Pane arranges the layout, and an Element describes what goes in each slot. Panes can nest, and one Window can take several Panes at once.
The component hierarchyโ
Click a node to see what it does and how it connects. Every Pane can place Items, link an Inventory, or nest further Panes.
Each player gets their own Window, and Windows cannot be shared between players. A Window manages the container, the title, and the open/close flow; the Panes, Items, and other UI components attached to it can be shared across Windows.
Beyond layout: content updates and visual effects
When several Windows chain into one flow, sessions handle moving forward and back.
Per-player or sharedโ
Of these components, Windows are counted per player. Panes and Elements never record which slot they occupy or who is looking at them, which leaves two ways to use them: build one set per player, or share a single set.
| Fresh on every open | Shared | |
|---|---|---|
| Best for | The vast majority of menus | Content every player should see identically |
| Between players | Fully isolated | One change, everyone sees it immediately |
| Watch out | No extra constraints | No player state inside the component |
Fresh on every openโ
Menu objects are cheap. Building one just parses a character template and creates a few items; there is no IO. So this is the default, and the quick start uses it too:
public static void open(Player viewer) {
// A fresh Pane and Window on every call
Window.builder(buildPane())
.setTitle(Component.text("Welcome Menu"))
.open(viewer);
}
Each player gets an isolated set of components: no concurrency to think about, no state left behind by the previous player. When in doubt, do this.
Sharedโ
Hand the same Item, the same Pane, or the same inventory to several Windows. When the component changes, every observer is notified and each Window refreshes only the affected slots.
This fits content that is identical for everyone by design: a shared guild chest, a server-wide leaderboard.
// One announcement Pane, two players each opening a Window onto the same content
Window.builder(boardPane).setTitle(Component.text("Announcements")).open(alice);
Window.builder(boardPane).setTitle(Component.text("Announcements")).open(bob);
This rule only applies to shared components. If one component serves several players at once, it cannot cache "who the current player is". Anything per-player comes from RenderContext or ItemClick.
The "fresh on every open" style above is exempt from this.