📄 absoluteconstraints.java
字号:
//from the NetBeans redist directory//$Id: AbsoluteConstraints.java,v 1.2 2000/10/28 16:55:18 daniela Exp $package org.ozoneDB.core;import java.awt.*;/** * An object that encapsulates position and (optionally) size for * Absolute positioning of components. * * * @see AbsoluteLayout * @version 1.01, Aug 19, 1998 ($Revision: 1.2 $) * @author Ian Formanek (modified softwarebuero m&b) */public class AbsoluteConstraints implements java.io.Serializable { /** Werte fuer GUI-einstellung*/ final static int MOTIF = 0; final static int WIN = 1; /** aktuelle GUI-einstellung*/ static int GUI = MOTIF; /** generated Serialized Version UID */ final static long serialVersionUID = 5261460716622152494L; /** The X position of the component */ public int x; /** The Y position of the component */ public int y; /** The width of the component or -1 if the component's preferred width should be used */ public int width = -1; /** The height of the component or -1 if the component's preferred height should be used */ public int height = -1; /** Groesse und position sind fest */ final static int FIXED = 0; /** */ final static int X_ABS = 1; final static int X_PROP = 2; final static int Y_ABS = 4; final static int Y_PROP = 8; final static int X2_ABS = 16; final static int X2_PROP = 32; final static int Y2_ABS = 64; final static int Y2_PROP = 128; /** Position wird proportional/fest der groesse des containers angepasst */ final static int MOVE_PROP = X_PROP | Y_PROP; final static int MOVE_ABS = X_ABS | Y_ABS; /** Groesse wird proportional/fest der groesse des containers angepasst */ final static int RESIZE_PROP = X2_PROP | Y2_PROP; final static int RESIZE_ABS = X2_ABS | Y2_ABS; /** */ public int policy = FIXED; /** * Creates a new AbsoluteConstraints for specified position. * @param pos The position to be represented by this AbsoluteConstraints */ public AbsoluteConstraints( Point pos ) { this( pos.x, pos.y ); } /** * Creates a new AbsoluteConstraints for specified position. * @param x The X position to be represented by this AbsoluteConstraints * @param y The Y position to be represented by this AbsoluteConstraints */ public AbsoluteConstraints( int x, int y ) { this.x = x; this.y = y; } /** * Creates a new AbsoluteConstraints for specified position and size. * @param pos The position to be represented by this AbsoluteConstraints * @param size The size to be represented by this AbsoluteConstraints or null * if the component's preferred size should be used */ public AbsoluteConstraints( Point pos, Dimension size ) { this.x = pos.x; this.y = pos.y; if (size != null) { this.width = size.width; this.height = size.height; } } /** * Creates a new AbsoluteConstraints for specified position and size. * @param x The X position to be represented by this AbsoluteConstraints * @param y The Y position to be represented by this AbsoluteConstraints * @param width The width to be represented by this AbsoluteConstraints or -1 if the * component's preferred width should be used * @param height The height to be represented by this AbsoluteConstraints or -1 if the * component's preferred height should be used */ public AbsoluteConstraints( int x, int y, int width, int height ) { this.x = x; this.y = y; this.width = width; this.height = height; } /** */ public AbsoluteConstraints( int x, int y, int width, int height, int policy ) { this.x = x; this.y = y; this.width = width; this.height = height; this.policy = policy; } /** @return The X position represented by this AbsoluteConstraints */ public int getX() { return x; } /** @return The Y position represented by this AbsoluteConstraints */ public int getY() { return y; } /** * @return The width represented by this AbsoluteConstraints or -1 if the * component's preferred width should be used */ public int getWidth() { return GUI == MOTIF || width == -1 ? width : width - 3; } /** * @return The height represented by this AbsoluteConstraints or -1 if the * component's preferred height should be used */ public int getHeight() { return GUI == MOTIF || height == -1 ? height : height - 5; } public String toString() { return super.toString() + " [x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + "]"; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -