|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.Spring
Safe:
Field Summary | |
static int |
UNSET
Enabled: An integer value signifying that a property value has not yet been calculated. |
Constructor Summary | |
protected |
Spring()
Used by factory methods to create a Spring . |
Method Summary | |
static Spring |
constant(int pref)
Enabled: Returns a strut -- a spring whose minimum, preferred, and maximum values each have the value pref . |
static Spring |
constant(int min,
int pref,
int max)
Enabled: Returns a spring whose minimum, preferred, and maximum values have the values: min , pref ,
and max respectively. |
(package private) static Spring |
difference(Spring s1,
Spring s2)
|
abstract int |
getMaximumValue()
Enabled: Returns the maximum value of this Spring . |
abstract int |
getMinimumValue()
Enabled: Returns the minimum value of this Spring . |
abstract int |
getPreferredValue()
Enabled: Returns the preferred value of this Spring . |
(package private) double |
getStrain()
|
abstract int |
getValue()
Enabled: Returns the current value of this Spring . |
(package private) boolean |
isCyclic(SpringLayout l)
|
static Spring |
max(Spring s1,
Spring s2)
Enabled: Returns max(s1, s2) : a spring whose value is always greater than (or equal to)
the values of both s1 and s2 . |
static Spring |
minus(Spring s)
Enabled: Returns -s : a spring running in the opposite direction to s . |
private double |
range(boolean contract)
|
(package private) void |
setStrain(double strain)
|
abstract void |
setValue(int value)
Enabled: Sets the current value of this Spring to value . |
static Spring |
sum(Spring s1,
Spring s2)
Enabled: Returns s1+s2 : a spring representing s1 and s2
in series. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int UNSET
Constructor Detail |
protected Spring()
Spring
.
constant(int)
,
constant(int, int, int)
,
max(javax.swing.Spring, javax.swing.Spring)
,
minus(javax.swing.Spring)
,
sum(javax.swing.Spring, javax.swing.Spring)
,
SpringLayout.Constraints
Method Detail |
public abstract int getMinimumValue()
Spring
.
minimumValue
property of this Spring
public abstract int getPreferredValue()
Spring
.
preferredValue
of this Spring
public abstract int getMaximumValue()
Spring
.
maximumValue
property of this Spring
public abstract int getValue()
Spring
.
value
property of this Spring
setValue(int)
public abstract void setValue(int value)
Spring
to value
.
value
- the new setting of the value
propertygetValue()
private double range(boolean contract)
double getStrain()
void setStrain(double strain)
boolean isCyclic(SpringLayout l)
public static Spring constant(int pref)
pref
.
pref
- the minimum, preferred, and
maximum values of the new spring
pref
AbstractSpring
public static Spring constant(int min, int pref, int max)
min
, pref
,
and max
respectively.
min
- the minimum value of the new springpref
- the preferred value of the new springmax
- the maximum value of the new spring
min
, pref
,
and max
respectivelyAbstractSpring
public static Spring minus(Spring s)
-s
: a spring running in the opposite direction to s
.
-s
: a spring running in the opposite direction to s
AbstractSpring
public static Spring sum(Spring s1, Spring s2)
s1+s2
: a spring representing s1
and s2
in series. In a sum, s3
, of two springs, s1
and s2
,
the strains of s1
, s2
, and s3
are maintained
at the same level (to within the precision implied by their integer values).
The strain of a spring in compression is:
value - pref ------------ pref - minand the strain of a spring in tension is:
value - pref ------------ max - prefWhen
setValue
is called on the sum spring, s3
, the strain
in s3
is calculated using one of the formulas above. Once the strain of
the sum is known, the values of s1
and s2
are
then set so that they are have a strain equal to that of the sum. The formulas are
evaluated so as to take rounding errors into account and ensure that the sum of
the values of s1
and s2
is exactly equal to
the value of s3
.
s1+s2
: a spring representing s1
and s2
in seriesAbstractSpring
public static Spring max(Spring s1, Spring s2)
max(s1, s2)
: a spring whose value is always greater than (or equal to)
the values of both s1
and s2
.
max(s1, s2)
: a spring whose value is always greater than (or equal to)
the values of both s1
and s2
AbstractSpring
static Spring difference(Spring s1, Spring s2)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |