summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GridPos.java
blob: 2a1b0200bb049f0cc66ad4293901a14443782198 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package org.openslx.dozmod.gui.helper;

import java.awt.GridBagConstraints;
import java.awt.Insets;

/**
 * Helper for creating Constraints when using GridBagLayout.
 * Deprecated, use GridManager instead.
 */
@Deprecated
public class GridPos {

	private static final Insets inset = new Insets(1, 1, 1, 1);

	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.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);
	}

}