Arch4J 1.1

org.arch4j.ui.layout
Class FrameConstraint

java.lang.Object
  |
  +--org.arch4j.ui.layout.OriginConstraint
        |
        +--org.arch4j.ui.layout.FrameConstraint

public class FrameConstraint
extends OriginConstraint

A FrameConstraint is used with an instance of FractionalLayout to compute a Rectangle relative to a containing Rectangle by computing the relative edges and then adding offsets to them. Any preferredSize of the component is ignored. A couple of examples:

Version:
1.01, 04/18/96
Author:
Eric Lunt (elunt@mcs.net)
See Also:
FractionalLayout

Field Summary
 int bottom
          Represents the number of pixels to be added as an offset to the bottom edge of a component.
 double bottomFraction
          A number between 0.0 and 1.0 which represents the relative fraction (of the container) for the bottom edge of a component.
 int right
          Represents the number of pixels to be added as an offset to the right edge of a component.
 double rightFraction
          A number between 0.0 and 1.0 which represents the relative fraction (of the container) for the right edge of a component.
 
Fields inherited from class org.arch4j.ui.layout.OriginConstraint
left, leftFraction, top, topFraction
 
Constructor Summary
FrameConstraint()
          Create an instanace of an FrameConstraint.
FrameConstraint(double lf, int l, double tf, int t, double rf, int r, double bf, int b)
          Create an instance of an FrameConstraint given the left fraction, the left offset, the top fraction, the top offset, the right fraction, the right offset, the bottom fraction, and the bottom offset.
 
Method Summary
protected  int adjustedBottom(Dimension containerSize)
          Given a container size, resolve the bottom edge of a component
 Rectangle adjustedRectangle(Dimension containerSize, Dimension componentSize)
          Given the size of a container and the component size, return a Rectangle which appropriately bounds the component given this constraint.
protected  int adjustedRight(Dimension containerSize)
          Given a container size, resolve the right edge of a component
 Dimension containSize(Dimension componentSize)
          Given the size of a component, return the smallest size container which could contain it given this constraint.
 void setFractionsAndOffsets(double lf, int l, double tf, int t, double rf, int r, double bf, int b)
          This method was created by a SmartGuide.
 
Methods inherited from class org.arch4j.ui.layout.OriginConstraint
adjustedLeft, adjustedTop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rightFraction

public double rightFraction
A number between 0.0 and 1.0 which represents the relative fraction (of the container) for the right edge of a component.


right

public int right
Represents the number of pixels to be added as an offset to the right edge of a component.


bottomFraction

public double bottomFraction
A number between 0.0 and 1.0 which represents the relative fraction (of the container) for the bottom edge of a component.


bottom

public int bottom
Represents the number of pixels to be added as an offset to the bottom edge of a component.

Constructor Detail

FrameConstraint

public FrameConstraint()
Create an instanace of an FrameConstraint. This will place all four sides of the component at the upper-left corner of the container, which isn't very useful by itself.


FrameConstraint

public FrameConstraint(double lf,
                       int l,
                       double tf,
                       int t,
                       double rf,
                       int r,
                       double bf,
                       int b)
Create an instance of an FrameConstraint given the left fraction, the left offset, the top fraction, the top offset, the right fraction, the right offset, the bottom fraction, and the bottom offset.

Parameters:
lf - the left fraction
l - the left offset
tf - the top fraction
t - the top offset
rf - the right fraction
r - the right offset
bf - the bottom fraction
b - the bottom offset
Method Detail

adjustedBottom

protected int adjustedBottom(Dimension containerSize)
Given a container size, resolve the bottom edge of a component

Parameters:
containerSize - the size of the container
Returns:
the pixel position of the bottom edge of the component

adjustedRectangle

public Rectangle adjustedRectangle(Dimension containerSize,
                                   Dimension componentSize)
Given the size of a container and the component size, return a Rectangle which appropriately bounds the component given this constraint.

Overrides:
adjustedRectangle in class OriginConstraint
Parameters:
containerSize - the size of the container
componentSize - the size of the component
Returns:
the containing rectangle

adjustedRight

protected int adjustedRight(Dimension containerSize)
Given a container size, resolve the right edge of a component

Parameters:
containerSize - the size of the container
Returns:
the pixel position of the right edge of the component

containSize

public Dimension containSize(Dimension componentSize)
Given the size of a component, return the smallest size container which could contain it given this constraint.

Overrides:
containSize in class OriginConstraint
Parameters:
componentSize - the size of a component
Returns:
the minimum size of a container to satisfy this contraint

setFractionsAndOffsets

public void setFractionsAndOffsets(double lf,
                                   int l,
                                   double tf,
                                   int t,
                                   double rf,
                                   int r,
                                   double bf,
                                   int b)
This method was created by a SmartGuide.

Parameters:
lf - double
l - int
tf - double
t - int
rf - double
r - int
bf - double
b - int

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.