javax.swing
Class SpringLayout.Constraints
- SpringLayout
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.
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
Constraints
public Constraints()
Creates a new Constraints object.
There is no constraint set.
Constraints
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.
component
- the component to track
Constraints
public Constraints(Spring x,
Spring y)
Creates a new Constraints object.
x
- the constraint for the left edge of the component.y
- the constraint for the upper edge of the component.
Constraints
public Constraints(Spring x,
Spring y,
Spring width,
Spring height)
Creates a new Constraints object.
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.
getConstraint
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
.
edgeName
- the name of the edge.
- the constraint for the specified edge.
getEast
public Spring getEast()
Returns the constraint for the right edge of the component.
- the right-edge constraint (== EAST).
getHeight
public Spring getHeight()
Returns the constraint for the height of the component.
getSouth
public Spring getSouth()
Returns the constraint for the lower edge of the component.
- the lower-edge constraint (== SOUTH).
getWidth
public Spring getWidth()
Returns the constraint for the width of the component.
getX
public Spring getX()
Returns the constraint for the left edge of the component.
- the left-edge constraint (== WEST).
getY
public Spring getY()
Returns the constraint for the upper edge of the component.
- the upper-edge constraint (== NORTH).
setConstraint
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.
edgeName
- the name of the edge, one of SpringLayout.Constraints
,
SpringLayout.Constraints
, SpringLayout.Constraints
or SpringLayout.Constraints
.s
- the constraint to be set.
setEast
public void setEast(Spring s)
Sets the EAST-constraint.
s
- the constraint to be set.
setHeight
public void setHeight(Spring s)
Sets the height-constraint.
s
- the constraint to be set.
setSouth
public void setSouth(Spring s)
Sets the SOUTH-constraint.
s
- the constraint to be set.
setWidth
public void setWidth(Spring s)
Sets the width-constraint.
s
- the constraint to be set.
setX
public void setX(Spring s)
Sets the WEST-constraint.
s
- the constraint to be set.
setY
public void setY(Spring s)
Sets the NORTH-constraint.
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.