From 1073af21305360bd33903c533cdac57e9f936294 Mon Sep 17 00:00:00 2001 From: Yuuta Liang Date: Tue, 28 Nov 2023 18:19:39 -0800 Subject: Move TUI and GUI into separate packages Signed-off-by: Yuuta Liang --- src/main/ui/widgets/GCBuilder.java | 213 ------------------------------------- 1 file changed, 213 deletions(-) delete mode 100644 src/main/ui/widgets/GCBuilder.java (limited to 'src/main/ui/widgets/GCBuilder.java') diff --git a/src/main/ui/widgets/GCBuilder.java b/src/main/ui/widgets/GCBuilder.java deleted file mode 100644 index 0590cc1..0000000 --- a/src/main/ui/widgets/GCBuilder.java +++ /dev/null @@ -1,213 +0,0 @@ -package ui.widgets; - -import java.awt.*; - -/** - * A builder for {@link GridBagConstraints}. - */ -public class GCBuilder { - /** - * Grix X and Y, defaults to {@link GridBagConstraints#RELATIVE} - */ - private int gridX = GridBagConstraints.RELATIVE; - - private int gridY = GridBagConstraints.RELATIVE; - - /** - * Weight X and Y, [0.0, 1.0], defaults to 0.0 - */ - private double weightX = 0.0; - - private double weightY = 0.0; - - /** - * Anchor, defaults to {@link GridBagConstraints#CENTER} - */ - private int anchor = GridBagConstraints.CENTER; - - /** - * How to stretch the component, defaults to {@link GridBagConstraints#NONE} - */ - private int fill = GridBagConstraints.NONE; - - /** - * Insects in pixels. - */ - private int insectTop = 0; - - private int insectLeft = 0; - - private int insectRight = 0; - - private int insectBottom = 0; - - /** - * EFFECTS: Build the {@link GridBagConstraints} based on parameters. - * Grid width, grid height, ipad X, ipad Y will be 1, 1, 0, 0. - */ - public GridBagConstraints build() { - return new GridBagConstraints(gridX, gridY, - 1, 1, - weightX, weightY, - anchor, fill, - new Insets(insectTop, insectLeft, insectBottom, insectRight), - 0, 0); - } - - /** - * EFFECTS: Set grid X and Y. - * REQUIRES: > 0 - * MODIFIES: this - */ - public GCBuilder gridXY(int gridX, int gridY) { - return this.gridX(gridX).gridY(gridY); - } - - /** - * EFFECTS: Set grid X. - * REQUIRES: > 0 - * MODIFIES: this - */ - public GCBuilder gridX(int gridX) { - this.gridX = gridX; - return this; - } - - /** - * EFFECTS: Set grid Y. - * REQUIRES: > 0 - * MODIFIES: this - */ - public GCBuilder gridY(int gridY) { - this.gridY = gridY; - return this; - } - - /** - * EFFECTS: Set weight X and Y. - * REQUIRES: [0.0, 1.0] - * MODIFIES: this - */ - public GCBuilder weightXY(double weightX, double weightY) { - return this.weightX(weightX).weightY(weightY); - } - - /** - * EFFECTS: Set weight X and Y to 1.0 - * MODIFIES: this - */ - public GCBuilder expandXY() { - return this.expandX().expandY(); - } - - /** - * EFFECTS: Set weight X to 1.0 - * MODIFIES: this - */ - public GCBuilder expandX() { - return this.weightX(1.0); - } - - /** - * EFFECTS: Set weight X to 1.0 - * MODIFIES: this - */ - public GCBuilder weightX(double weightX) { - this.weightX = weightX; - return this; - } - - /** - * EFFECTS: Set weight Y to 1.0 - * MODIFIES: this - */ - public GCBuilder expandY() { - return this.weightY(1.0); - } - - /** - * EFFECTS: Set weight X to 1.0 - * MODIFIES: this - */ - public GCBuilder weightY(double weightY) { - this.weightY = weightY; - return this; - } - - /** - * EFFECTS: Set anchor. - * REQUIRES: anchor in {@link GridBagConstraints} constants. - * MODIFIES: this - */ - public GCBuilder anchor(int anchor) { - this.anchor = anchor; - return this; - } - - /** - * EFFECTS: Set fill. - * REQUIRES: fill in {@link GridBagConstraints} constants. - * MODIFIES: this - */ - public GCBuilder fill(int fill) { - this.fill = fill; - return this; - } - - /** - * EFFECTS: Set insects to be 8, 8, 8, 8 - * MODIFIES: this - */ - public GCBuilder marginInsects() { - return this.insects(8, 8, 8, 8); - } - - /** - * EFFECTS: Set insects. - * REQUIRES: >= 0 - * MODIFIES: this - */ - public GCBuilder insects(int top, int left, int bottom, int right) { - return this.insectTop(top).insectLeft(left).insectBottom(bottom).insectRight(right); - } - - /** - * EFFECTS: Set top insect - * REQUIRES: >= 0 - * MODIFIES: this - */ - public GCBuilder insectTop(int insectTop) { - this.insectTop = insectTop; - return this; - } - - /** - * EFFECTS: Set left insect - * REQUIRES: >= 0 - * MODIFIES: this - */ - public GCBuilder insectLeft(int insectLeft) { - this.insectLeft = insectLeft; - return this; - } - - /** - * EFFECTS: Set right insect - * REQUIRES: >= 0 - * MODIFIES: this - */ - public GCBuilder insectRight(int insectRight) { - this.insectRight = insectRight; - return this; - } - - /** - * EFFECTS: Set bottom insect - * REQUIRES: >= 0 - * MODIFIES: this - */ - public GCBuilder insectBottom(int insectBottom) { - this.insectBottom = insectBottom; - return this; - } -} -- cgit v1.2.3