diff options
Diffstat (limited to 'base/src/main/java/bjc/utils/gui/layout')
3 files changed, 72 insertions, 0 deletions
diff --git a/base/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java b/base/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java new file mode 100644 index 0000000..6f384f2 --- /dev/null +++ b/base/src/main/java/bjc/utils/gui/layout/AutosizeLayout.java @@ -0,0 +1,22 @@ +package bjc.utils.gui.layout; + +import java.awt.GridLayout; + +/** + * A layout that simply holds one component that it auto-resizes whenever it is + * resized. + * + * @author ben + * + */ +public class AutosizeLayout extends GridLayout { + // Version id for serialization + private static final long serialVersionUID = -2495693595953396924L; + + /** + * Create a new auto-size layout. + */ + public AutosizeLayout() { + super(1, 1); + } +} diff --git a/base/src/main/java/bjc/utils/gui/layout/HLayout.java b/base/src/main/java/bjc/utils/gui/layout/HLayout.java new file mode 100644 index 0000000..4ed1661 --- /dev/null +++ b/base/src/main/java/bjc/utils/gui/layout/HLayout.java @@ -0,0 +1,25 @@ +package bjc.utils.gui.layout; + +import java.awt.GridLayout; + +/** + * A layout manager that lays out its components horizontally, evenly sizing + * them. + * + * @author ben + * + */ +public class HLayout extends GridLayout { + // Version ID for serialization + private static final long serialVersionUID = 1244964456966270026L; + + /** + * Create a new horizontal layout with the specified number of columns. + * + * @param columns + * The number of columns in this layout. + */ + public HLayout(final int columns) { + super(1, columns); + } +} diff --git a/base/src/main/java/bjc/utils/gui/layout/VLayout.java b/base/src/main/java/bjc/utils/gui/layout/VLayout.java new file mode 100644 index 0000000..6993365 --- /dev/null +++ b/base/src/main/java/bjc/utils/gui/layout/VLayout.java @@ -0,0 +1,25 @@ +package bjc.utils.gui.layout; + +import java.awt.GridLayout; + +/** + * A layout that lays out its components vertically, evenly sharing space among + * them. + * + * @author ben + * + */ +public class VLayout extends GridLayout { + // Version ID for serializations + private static final long serialVersionUID = -6417962941602322663L; + + /** + * Create a new vertical layout with the specified number of rows. + * + * @param rows + * The number of rows. + */ + public VLayout(final int rows) { + super(rows, 1); + } +} |
