summaryrefslogblamecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/GridPos.java
blob: 2a1b0200bb049f0cc66ad4293901a14443782198 (plain) (tree)
1
2
3
4
5
6
7
8
9
10




                                      




                                                            

                      
                                                                   













                                                                                                       

                                                                                                                














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

}