Skip to content

Instantly share code, notes, and snippets.

@isXander
Created May 20, 2023 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isXander/8d11b78df97cb14000c638ea0d0d65d2 to your computer and use it in GitHub Desktop.
Save isXander/8d11b78df97cb14000c638ea0d0d65d2 to your computer and use it in GitHub Desktop.
var rootLayout = layout.createRowHelper(3);
rootLayout.addChild(new TabListWidget<>(
() -> new ScreenRectangle(tabArea.position(), tabArea.width() / 3 * 2 + 1, tabArea.height()),
this.optionList
), 2);
var buttonGrid = new GridLayout();
buttonGrid.defaultCellSetting().padding(2, 2, 2, 0);
rootLayout.addChild(buttonGrid, 1, rootLayout.newCellSettings().alignHorizontallyRight().alignVerticallyBottom());
int columnWidth = width / 3;
int padding = columnWidth / 20;
columnWidth = Math.min(columnWidth, 400);
int paddedWidth = columnWidth - padding * 2;
saveFinishedButton = Button.builder(Component.literal("Done"), btn -> {}).width(paddedWidth).build();
cancelResetButton = Button.builder(Component.literal("Cancel"), btn -> {}).width(paddedWidth / 2 - 2).build();
undoButton = Button.builder(Component.literal("Undo"), btn -> {}).width(paddedWidth / 2 - 2).build();
var buttonLayout = buttonGrid.createRowHelper(2);
buttonLayout.addChild(cancelResetButton, 1);
buttonLayout.addChild(undoButton, 1);
buttonLayout.addChild(saveFinishedButton, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment