首页>代码>JAVA Swing控件开发图书馆后台管理系统源码下载>/BookManagerment/src/com/cloudgarden/layout/AnchorConstraint.java
/*
 */
package com.cloudgarden.layout;

/**
 * Used by both AnchorLayout (SWT) and AnchorLayoutManager (Swing)
 */
public class AnchorConstraint {

	/**
	 * Meaning: This side is not anchored.
	 */
	public static final int ANCHOR_NONE = 0;

	/**
	 * (Relative anchor) Meaning: This side is anchored so that it always 
	 * occurs a fixed fraction of
	 * the distance along it's parent's side. The position is calculated by
	 * the formula " position = (parent side)*(value)/1000 " so for
	 * instance if top=100 and topType == ANCHOR_REL then the
	 * value of y for this side would be (parent height)*top/1000.
	 */
	public static final int ANCHOR_REL = 1;

	/**
	 * (Absolute anchor) Meaning: This side is anchored a fixed distance
	 * in pixels (given by the value for this side) from it's parent's respective side.
	 * For instance, if bottomType == ANCHOR_ABS and bottom = 100 then the
	 * bottom side of this component will remain fixed 100 pixels from
	 * the bottom side of it's parent container.
	 */
	public static final int ANCHOR_ABS = 2;

	public int top;
	public int bottom;
	public int left;
	public int right;
	public int topType;
	public int bottomType;
	public int rightType;
	public int leftType;

	public AnchorConstraint() {
		this(0, 0, 0, 0, ANCHOR_NONE, ANCHOR_NONE, ANCHOR_NONE, ANCHOR_NONE);
	}

	/**
	 * Creates an AnchorConstraint.
	 * @param top - value (relative or absolute) for top side
	 * @param right - like 'top' but for right side
	 * @param bottom - like 'top' but for bottom side
	 * @param left - like 'top' but for left side
	 * @param topType - either ANCHOR_ABS, ANCHOR_REL or ANCHOR_NONE
	 * to indicate whether the 'top' parameter is an absolute value (in pixels) or
	 * a fractional value (in 1/1000 ths) of the height of this component's parent,
	 * denoting where the anchor will be applied (if at all).
	 * @param rightType - like 'topType' but for right side
	 * @param bottomType - like 'topType' but for bottom side
	 * @param leftType - like 'topType' but for left side
	 */
	public AnchorConstraint(
		int top,
		int right,
		int bottom,
		int left,
		int topType,
		int rightType,
		int bottomType,
		int leftType) {
		this.top = top;
		this.bottom = bottom;
		this.left = left;
		this.right = right;
		this.topType = topType;
		this.rightType = rightType;
		this.bottomType = bottomType;
		this.leftType = leftType;
	}

}
最近下载更多
yuexiaolong  LV1 2023年7月4日
user0810  LV4 2023年1月5日
770823669  LV6 2022年10月3日
wyx065747  LV67 2022年4月1日
benbosn  LV15 2022年2月11日
Demo1111  LV30 2021年12月11日
wangyunhao  LV10 2021年12月9日
392742064  LV1 2021年9月26日
zktotti 2021年6月23日
暂无贡献等级
itcontect  LV9 2021年1月20日
最近浏览更多
woldxy  LV12 4月1日
akittyboy  LV9 3月22日
wenMN1994  LV13 2月6日
lshlsh 2023年12月25日
暂无贡献等级
李朝磊  LV18 2023年12月3日
sunshine9920  LV12 2023年10月23日
2036495585  LV9 2023年9月25日
KAIzx11  LV7 2023年6月25日
LongTory  LV2 2023年6月6日
CL200228  LV4 2023年4月15日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友