v1.0.0 JAVA MOD LIBRARY
Popups
Composable modal dialog system built from overlay, block, popup, popupHeader, popupContent, and popupActions.
OreUi provides a composable modal popup system constructed from overlay(...), block(), popup(...), popupHeader(...), popupContent(...), and popupActions(...) (plus menuButton(...) rows inside list/menu dialogs).
Click to test live modal backdrop, Escape key, and Seamless close button.
Action Popup
Your main text goes here. This space should be used to tell the user about the content or actions it's going to perform.
Your secondary text can go here.
And you can also put a tertiary text here.
Menu Popup
3
Anatomy & Composition
A complete modal popup draws a translucent scrim, blocks input behind it, sizes itself from popupContentHeight(...) + popupActionsHeight(...), and renders its sections top-to-bottom:
ui.overlay(OreTone.OVERLAY_POPUP)+ui.block(): Dims the background and swallows all earlier hit targets and Tab stops so clicks, hovers, and focus do not leak underneath.ui.popup(x, y, w, h): Draws the1pxdark outer frame (OreTone.DARK).ui.popupHeader(...):24pxtall#585959(OreTone.BAR) bar with centered title, optionalOreAccentbadge, and seamless close button.ui.popupContent(...):#373A39(OreTone.POPUP_BODY) body with10pxpadding and wrapped paragraphs ranked in opacity (100%,75%,45%white).ui.popupActions(...):#585959footer bar supporting"horizontal"(2 side-by-side buttons) or"vertical"(stacked buttons) layouts.
Method Signatures (OreUi)
// Translucent backdrop (OVERLAY_PANEL, OVERLAY_MENU, OVERLAY_POPUP)
public void overlay(int colour)
public void overlay(int x0, int y0, int x1, int y1, int colour)
// Swallows clicks, hovers, and Tab focus for everything drawn prior
public void block()
// Outer 1 px dark frame
public void popup(int x, int y, int w, int h)
// Header bar (24 px high; pass null for unused badge/accent/close)
public int popupHeader(int x, int y, int w, String title, String badge, OreAccent accent,
String[] close, String tip, Runnable onClose)
// Auto-wrapped body paragraphs and height pre-calculator
public int popupContent(int x, int y, int w, String... paragraphs)
public int popupContentHeight(int w, String... paragraphs)
// Action button bar and height pre-calculator
public int popupActions(int x, int y, int w, boolean vertical, String[] labels,
OreVariant[] variants, Runnable[] actions)
public int popupActionsHeight(boolean vertical, int count)
Example
private boolean showDeleteDialog = false;
public void renderDeleteDialog(OreUi ui) {
if (!showDeleteDialog) return;
ui.overlay(OreTone.OVERLAY_POPUP);
ui.block();
int pw = 280;
String[] paragraphs = {
"Delete this world?",
"This world will be permanently removed from this device."
};
int headerH = 24;
int bodyH = ui.popupContentHeight(pw - 2, paragraphs);
int actionsH = ui.popupActionsHeight(false, 2);
int ph = headerH + bodyH + actionsH + 2;
int px = (this.width - pw) / 2;
int py = (this.height - ph) / 2;
ui.popup(px, py, pw, ph);
int cy = py + 1;
cy += ui.popupHeader(px + 1, cy, pw - 2, "Confirm", null, null,
OreIcon.CLOSE.small, "Close", () -> showDeleteDialog = false);
cy += ui.popupContent(px + 1, cy, pw - 2, paragraphs);
ui.popupActions(px + 1, cy, pw - 2, false,
new String[] { "Cancel", "Delete" },
new OreVariant[] { OreVariant.GENERAL, OreVariant.DESTRUCTIVE },
new Runnable[] {
() -> showDeleteDialog = false,
() -> {
deleteWorld();
showDeleteDialog = false;
}
});
}