summaryrefslogtreecommitdiff
path: root/javax/swing/SpringLayout.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2006-03-04 20:57:24 +0000
committerTom Tromey <tromey@redhat.com>2006-03-04 20:57:24 +0000
commit1e8a3c5859414e154b43cfe938ff32f802c9fd6c (patch)
tree10ce648a9e79b07cc77ed70df69e4b5bd4c10580 /javax/swing/SpringLayout.java
parent697d7f8d577ae6664a2a3539c5ffba9b815ca317 (diff)
downloadclasspath-1e8a3c5859414e154b43cfe938ff32f802c9fd6c.tar.gz
* javax/swing/SpringLayout.java (Constraints): New constructor.
* javax/swing/Spring.java (width): New method. (height): Likewise. (scale): Likewise.
Diffstat (limited to 'javax/swing/SpringLayout.java')
-rw-r--r--javax/swing/SpringLayout.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/javax/swing/SpringLayout.java b/javax/swing/SpringLayout.java
index 0f353e17b..8d46a736a 100644
--- a/javax/swing/SpringLayout.java
+++ b/javax/swing/SpringLayout.java
@@ -150,6 +150,25 @@ public class SpringLayout implements LayoutManager2
}
/**
+ * Create a new Constraints object which tracks the indicated
+ * component. The x and y positions for this Constraints object
+ * are constant Springs created with the component's location at
+ * the time this constructor is called. The width and height
+ * of this Constraints are Springs created using
+ * {@link Spring#width(Component)} and {@link Spring#height(Component)},
+ * respectively.
+ * @param component the component to track
+ * @since 1.5
+ */
+ public Constraints(Component component)
+ {
+ this(Spring.constant(component.getX()),
+ Spring.constant(component.getY()),
+ Spring.width(component),
+ Spring.height(component));
+ }
+
+ /**
* Returns the constraint for the edge with the <code>edgeName</code>.
* This is expected to be one of
* {@link #EAST}, {@link #WEST}, {@link #NORTH} or {@link #SOUTH}.