diff options
author | Simon Rettberg | 2015-07-29 15:14:08 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-07-29 15:14:08 +0200 |
commit | e0ca8b7a3fd299505ad964a1d20d1631920c2a8f (patch) | |
tree | 1975709d3e7954ed694a90813ae5a15e263d6846 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper | |
parent | [client] Add JTable helper class ListTable (diff) | |
download | tutor-module-e0ca8b7a3fd299505ad964a1d20d1631920c2a8f.tar.gz tutor-module-e0ca8b7a3fd299505ad964a1d20d1631920c2a8f.tar.xz tutor-module-e0ca8b7a3fd299505ad964a1d20d1631920c2a8f.zip |
[client] ImageListWindow ported to Swing
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GridPos.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GridPos.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GridPos.java new file mode 100644 index 00000000..6cb5bfe0 --- /dev/null +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GridPos.java @@ -0,0 +1,39 @@ +package org.openslx.dozmod.gui.helper; + +import java.awt.GridBagConstraints; +import java.awt.Insets; + +public class GridPos { + + private static final Insets inset = new Insets(0, 0, 0, 0); + + public static GridBagConstraints get(int cellX, int cellY, int spanX, int spanY, boolean fillX, + boolean fillY) { + int fill = 0, wx = 0, wy = 0; + if (fillX && fillY) { + fill = GridBagConstraints.BOTH; + wx = wy = 1; + } else if (fillX) { + fill = GridBagConstraints.HORIZONTAL; + wx = 1; + } else if (fillY) { + fill = GridBagConstraints.VERTICAL; + wy = 1; + } + return new GridBagConstraints(cellX, cellY, spanX, spanY, wx, wy, + GridBagConstraints.FIRST_LINE_START, fill, inset, 0, 0); + } + + public static GridBagConstraints get(int cellX, int cellY, int spanX, int spanY) { + return get(cellX, cellY, spanX, spanY, false, false); + } + + public static GridBagConstraints get(int cellX, int cellY, boolean fillX, boolean fillY) { + return get(cellX, cellY, 1, 1, fillX, fillY); + } + + public static GridBagConstraints get(int cellX, int cellY) { + return get(cellX, cellY, 1, 1); + } + +} |