JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.swing.gauge
Class LinearConstraint

java.lang.Object
  |
  +--com.klg.jclass.swing.gauge.GaugeConstraint
        |
        +--com.klg.jclass.swing.gauge.LinearConstraint
All Implemented Interfaces:
Serializable

public class LinearConstraint
extends GaugeConstraint
implements Serializable

A LinearConstraint is one that provides layout information for a component that needs to be placed on a linear gauge. It provides information to the layout by giving a distance either horizontally or vertically (depending on the orientation of the gauge's linear scale) from top-left corner of the scale and a position from the top or left of the scale.

See Also:
Serialized Form

Field Summary
protected  double position
          The position at which to place a label on the scale.
 
Fields inherited from class com.klg.jclass.swing.gauge.GaugeConstraint
extent, gauge
 
Constructor Summary
LinearConstraint(com.klg.jclass.swing.gauge.JCGauge gauge, double extent, double position)
          Constructor for LinearConstraint using a JComponent as the component.
LinearConstraint(com.klg.jclass.swing.gauge.JCGauge gauge, double extent, int position)
          Constructor for LinearConstraint using a JComponent as the component.
 
Method Summary
 int getPosition()
          Returns the position (normally corresponding to a particular scale value) at which this component will be placed on the scale as an integer
 double getPositionAsDouble()
          Returns the position (normally corresponding to a particular scale value) at which this component will be placed on the scale as a double.
 void setPosition(int position)
          Sets the position (normally corresponding to a particular scale value) at which this component will be placed as an integer.
 void setPositionAsDouble(double position)
          Sets the position (normally corresponding to a particular scale value) at which this component will be placed as a double.
 String toString()
          Return a string version of this constraint
 
Methods inherited from class com.klg.jclass.swing.gauge.GaugeConstraint
getExtent, getGauge, setExtent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

position

protected double position
The position at which to place a label on the scale. The position is specified as a percent from the width of the scale (horizontal orientation) or the height of the scale (vertical orientation).

Constructor Detail

LinearConstraint

public LinearConstraint(com.klg.jclass.swing.gauge.JCGauge gauge,
                        double extent,
                        int position)
Constructor for LinearConstraint using a JComponent as the component.

Parameters:
extent - The distance from the top-left of the rectangle. The distance is vertical for horizontal scales and horizontal for vertical scales and is specified as a ratio of this distance in pixels to the height or width of the scale.
position - The position (normally corresponding to a particular scale value) at which this component will be placed (at an "extent" distance from the top or left of the scale). The position is specified as a percent from the width of the scale (horizontal orientation) or the height of the scale (vertical orientation). Percentage specified as an integer.

LinearConstraint

public LinearConstraint(com.klg.jclass.swing.gauge.JCGauge gauge,
                        double extent,
                        double position)
Constructor for LinearConstraint using a JComponent as the component.

Parameters:
extent - The distance from the top-left of the rectangle. The distance is vertical for horizontal scales and horizontal for vertical scales and is specified as a ratio of this distance in pixels to the height or width of the scale.
position - The position (normally corresponding to a particular scale value) at which this component will be placed (at an "extent" distance from the top or left of the scale). The position is specified as a percent from the width of the scale (horizontal orientation) or the height of the scale (vertical orientation). Percentage specified as an double.
Method Detail

getPosition

public int getPosition()
Returns the position (normally corresponding to a particular scale value) at which this component will be placed on the scale as an integer

Returns:
The position at which this component will be placed

setPosition

public void setPosition(int position)
Sets the position (normally corresponding to a particular scale value) at which this component will be placed as an integer.

Parameters:
position - The position at which this component will be placed

getPositionAsDouble

public double getPositionAsDouble()
Returns the position (normally corresponding to a particular scale value) at which this component will be placed on the scale as a double.

Returns:
The position at which this component will be placed

setPositionAsDouble

public void setPositionAsDouble(double position)
Sets the position (normally corresponding to a particular scale value) at which this component will be placed as a double.

Parameters:
position - The position at which this component will be placed

toString

public String toString()
Return a string version of this constraint

Overrides:
toString in class Object
Returns:
A string version of this constraint

Copyright © 2004 Quest Software Inc..
All rights reserved.