Prev Class | Next Class | Frames | No Frames |

Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |

`java.lang.Object`

`javax.swing.SpringLayout.Constraints`

**Enclosing Class:**- SpringLayout

`public static class `**SpringLayout.Constraints**

`extends Object`

The constraints that define the relationships between components.
Each Constraints object can hold 4 Springs: one for each edge of the
component. Additionally it can hold Springs for the components width
and the components height. Since the height and width constraints are
dependend on the other constraints, a component can be over-constraint.
In this case (like when all of NORTH, SOUTH and HEIGHT are constraint),
the values are adjusted, so that the mathematics still hold true.

## Constructor Summary

`Constraints()`

- Creates a new Constraints object.

`Constraints(Component component)`

- Create a new Constraints object which tracks the indicated component.

`Constraints(Spring x, Spring y)`

- Creates a new Constraints object.

`Constraints(Spring x, Spring y, Spring width, Spring height)`

- Creates a new Constraints object.

## Method Summary

`void`

`Spring`

`getConstraint(String edgeName)`

- Returns the constraint for the edge with the
`edgeName`

.

`Spring`

`getEast()`

- Returns the constraint for the right edge of the component.

`Spring`

`getHeight()`

- Returns the constraint for the height of the component.

`Spring`

`getSouth()`

- Returns the constraint for the lower edge of the component.

`Spring`

`getWidth()`

- Returns the constraint for the width of the component.

`Spring`

`getX()`

- Returns the constraint for the left edge of the component.

`Spring`

`getY()`

- Returns the constraint for the upper edge of the component.

`void`

`setConstraint(String edgeName, Spring s)`

- Sets a constraint for the specified edge.

`void`

`void`

`void`

`void`

`void`

`void`

### Methods inherited from class java.lang.Object

`clone`

,`equals`

,`extends Object> getClass`

,`finalize`

,`hashCode`

,`notify`

,`notifyAll`

,`toString`

,`wait`

,`wait`

,`wait`

public Constraints(Component component)

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`Spring.width(Component)`

and`Spring.height(Component)`

, respectively.

Parameters:`component`

- the component to track

Since:- 1.5

public Constraints(Spring x, Spring y)

Creates a new Constraints object.

Parameters:`x`

- the constraint for the left edge of the component.`y`

- the constraint for the upper edge of the component.

public Constraints(Spring x, Spring y, Spring width, Spring height)

Creates a new Constraints object.

Parameters:`x`

- the constraint for the left edge of the component.`y`

- the constraint for the upper edge of the component.`width`

- the constraint for the width of the component.`height`

- the constraint for the height of the component.

public Spring getConstraint(String edgeName)

Returns the constraint for the edge with the`edgeName`

. This is expected to be one of`SpringLayout.Constraints`

,`SpringLayout.Constraints`

,`SpringLayout.Constraints`

or`SpringLayout.Constraints`

.

Parameters:`edgeName`

- the name of the edge.

Returns:- the constraint for the specified edge.

public Spring getEast()

Returns the constraint for the right edge of the component.

Returns:- the right-edge constraint (== EAST).

public Spring getHeight()

Returns the constraint for the height of the component.

Returns:- the height constraint.

public Spring getSouth()

Returns the constraint for the lower edge of the component.

Returns:- the lower-edge constraint (== SOUTH).

public Spring getWidth()

Returns the constraint for the width of the component.

Returns:- the width constraint.

public Spring getX()

Returns the constraint for the left edge of the component.

Returns:- the left-edge constraint (== WEST).

public Spring getY()

Returns the constraint for the upper edge of the component.

Returns:- the upper-edge constraint (== NORTH).

public void setConstraint(String edgeName, Spring s)

Sets a constraint for the specified edge. If this leads to an over-constrained situation, the constraints get adjusted, so that the mathematics still hold true.

Parameters:`edgeName`

- the name of the edge, one of`SpringLayout.Constraints`

,`SpringLayout.Constraints`

,`SpringLayout.Constraints`

or`SpringLayout.Constraints`

.`s`

- the constraint to be set.

public void setEast(Spring s)

Sets the EAST-constraint.

Parameters:`s`

- the constraint to be set.

public void setHeight(Spring s)

Sets the height-constraint.

Parameters:`s`

- the constraint to be set.

public void setSouth(Spring s)

Sets the SOUTH-constraint.

Parameters:`s`

- the constraint to be set.

public void setWidth(Spring s)

Sets the width-constraint.

Parameters:`s`

- the constraint to be set.

SpringLayout.java --
Copyright (C) 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.