2 * Sun Public License Notice
4 * The contents of this file are subject to the Sun Public License
5 * Version 1.0 (the "License"). You may not use this file except in
6 * compliance with the License. A copy of the License is available at
9 * The Original Code is NetBeans. The Initial Developer of the Original
10 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
11 * Microsystems, Inc. All Rights Reserved.
14 package org
.netbeans
.lib
.awtextra
;
16 import java
.awt
.Dimension
;
17 import java
.awt
.Point
;
19 /** An object that encapsulates position and (optionally) size for
20 * Absolute positioning of components.
23 * @version 1.01, Aug 19, 1998
25 public class AbsoluteConstraints
implements java
.io
.Serializable
{
26 /** generated Serialized Version UID */
27 static final long serialVersionUID
= 5261460716622152494L;
29 /** The X position of the component */
31 /** The Y position of the component */
33 /** The width of the component or -1 if the component's preferred width should be used */
34 public int width
= -1;
35 /** The height of the component or -1 if the component's preferred height should be used */
36 public int height
= -1;
38 /** Creates a new AbsoluteConstraints for specified position.
39 * @param pos The position to be represented by this AbsoluteConstraints
41 public AbsoluteConstraints(Point pos
) {
45 /** Creates a new AbsoluteConstraints for specified position.
46 * @param x The X position to be represented by this AbsoluteConstraints
47 * @param y The Y position to be represented by this AbsoluteConstraints
49 public AbsoluteConstraints(int x
, int y
) {
54 /** Creates a new AbsoluteConstraints for specified position and size.
55 * @param pos The position to be represented by this AbsoluteConstraints
56 * @param size The size to be represented by this AbsoluteConstraints or null
57 * if the component's preferred size should be used
59 public AbsoluteConstraints(Point pos
, Dimension size
) {
63 this.width
= size
.width
;
64 this.height
= size
.height
;
68 /** Creates a new AbsoluteConstraints for specified position and size.
69 * @param x The X position to be represented by this AbsoluteConstraints
70 * @param y The Y position to be represented by this AbsoluteConstraints
71 * @param width The width to be represented by this AbsoluteConstraints or -1 if the
72 * component's preferred width should be used
73 * @param height The height to be represented by this AbsoluteConstraints or -1 if the
74 * component's preferred height should be used
76 public AbsoluteConstraints(int x
, int y
, int width
, int height
) {
83 /** @return The X position represented by this AbsoluteConstraints */
88 /** @return The Y position represented by this AbsoluteConstraints */
93 /** @return The width represented by this AbsoluteConstraints or -1 if the
94 * component's preferred width should be used
96 public int getWidth () {
100 /** @return The height represented by this AbsoluteConstraints or -1 if the
101 * component's preferred height should be used
103 public int getHeight () {
107 public String
toString () {
108 return super.toString () +" [x="+x
+", y="+y
+", width="+width
+", height="+height
+"]";