package com.mindprod.layout;
/**
* Constraint for use with StarLayout
*
* @author Roedy Green
* @version 1.0
* @since 2003-06-01
*/
public class StarConstraint
{
/**
* Constructor
*
* @param angleInDegrees
* Where to place the component relative
* to center of the box.
* Angle in degrees e.g.
* East = 0 North = 90 West = 180 South = -90
* NE = 45 NW = 135 SW = -135 SE = -45
*
* @param radius distance from center of Container to center of Component in pixels.
*
* @param tweakx tweak in the x direction to fine tune to
* adjust when image in not perfectly centred in
* its box. +ve moves image right. -ve left.
*
* @param tweaky tweak in the y direction to fine tune to
* adjust when image in not perfectly centred in
* its box. +ve moves image down. -ve moves up.
*/
public StarConstraint ( int angleInDegrees, int radius, int tweakx, int tweaky )
{
this.angleInRadians = -Math.toRadians( angleInDegrees );
this.radius = radius;
this.tweakx = tweakx;
this.tweaky = -tweaky;
}
/**
* Constructor without tweaks.
*
* @param angleInDegrees
* Angle in degrees
* East = 0 North = 90 West = 180 South = 270
*
* @param radius radius in pixels
*/
public StarConstraint ( int angleInDegrees, int radius )
{
this( angleInDegrees, radius, 0, 0 );
}
/**
* the angle measured from the centre of the container where the centre
* of the component should be placed. In radians.
*/
protected double angleInRadians;
/**
* distance in pixels from the center of the Container
* to the center of the Component.
*/
protected double radius;
/**
* Amount to shift the Component right to adjust from calculated
* position. negative for left adjust.
*/
protected double tweakx;
/**
* Amount to adjust the component down from its calculated position.
* negative means adjust up.
*/
protected double tweaky;
}