|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.sourceforge.chart2d.Area
An Advanced Bordered Area. Allows auto and manual resizing and auto and manual positioning. Contains many public static variables for use when extending this class.
Basic Sizing and Colors:
The typical bordered area class will simply paint a border of a specified
thickness within an area, where the inner edges of the area touch the outer
edges of the border. This class can do much more. Each border can be set
to a different thickness and color. This introduces the problem of handling
the corners of the borders. If the left border has color green, and the top
border has color red, which color is the top left corner? Each corner can
be associated with any adjacent border.
Inner Space And Gaps:
Sometimes, some space between the thing bordered and the border is desired.
That is, if bordering some text, then having some space between the
text and the border may be desirable. The thickness of the gap between the
the left, right, top, and bottom borders may each be individually set.
The location and size of this inner space may be obtained directly.
Resizing And Growing Borders And Gaps:
The borders and gaps can automatically grow when the size is changed. In
order to maintain the look of zooming in on something, the borders and gaps
can grow with the resizing of the area. For example, if the area grows in
the horizontal direction, then the left and right borders and gaps will
grow respective of the amount of change in the area width, depending
on this classes settings. If keeping any of the borders equal to any of the
others is desireable, such as a "grow only when all grow" policy, then
any border may be associated with any other border. The sizes of the
associated borders will be equal to the least of them.
More Basics:
This area can have a background color, or no background at all. And
each border and gap can be set to not exist, individually.
Locating: Automatically and Manually:
Sometimes the size of component to be bordered cannot be known until after
the borders and gaps have been calculated (relevant when using growing
borders and gaps). This class allows the available space, after subtracting
borders and gaps, to obtained. The size of the component to be bordered can
then be calculated, making sure it fits within this space. The size of the
component can be passed to this class, this class will place the gaps and
borderes around the component for a (near) perfect fit. This means that
where to place this bordered area within the maximum area is an open
question. This class allows options of automatic centering (both
horizontally and vertically, justifying to the left, right, top, and/or
bottom edges of the maximum area, and doing nothing such that the area can
be manually set, and any combination thereof.
Examples:
setAutoSizes (true, true);
setAutoSizes (false, true);
setAutoSizes (true, false);
setAutoJustifys (true, true);
setJustifications (CENTER, CENTER);
setAutoSizes (false, false);
setAutoJustifys (false, false);
Details Of Growing:
Growing is based on "model" sizes. By default, everything has a
model size (the area, the borders, and the gaps). The defaults
currently are the first maximum size setting for the area,
2 (for all borders), and 2 (for all gaps). Growing
is accomplished by dividing the maximum area size by the model area size
and applying this ratio the border and gap thicknesses.
If growing in the horizontal direction, the width sizes are used. If
growing in the vertical direction, the height sizes are used. If growing
in both directions, then both are calculated and the lesser is used.
However, all of these values can be changed. Ideally, one would set
the model area size to your normal viewing size, and all of the
inner components model sizes (borders and thicknesses) to the best sizes
at this model area size. However, just setting the model area size to the
normal viewing size of the area most likely will be sufficient. Generally,
the initial size is the normal size, do set the model size to the initial
size, use the resetAreaModel method before setting the maximum size. When
you set the maximum size, the area model size will automatically reset
itself to this size.
Notes:
new Point() instead of null.
| Field Summary | |
(package private) static int |
BETWEEN
Indicates the betweem. |
(package private) static int |
BOTTOM
Indicates the bottom. |
(package private) static int |
CENTER
Indicates the center. |
(package private) static int |
CENTERED
Indicates the centered. |
(package private) static float[] |
CONTINUOUS
Indicates the continuous. |
(package private) static float[] |
DASHED
Indicates the dashed. |
(package private) static float[] |
DOTTED
Indicates the dotted. |
(package private) static int |
FLOAT
Indicates float. |
(package private) static int |
HEIGHT
Indicates the height. |
(package private) static int |
HORIZONTAL
Indicates the horizontal. |
(package private) static int |
INTEGER
Indicates integer. |
(package private) static int |
LABELSBOTTOM
Indicates the labels bottom. |
(package private) static int |
LABELSLEFT
Indicates the labels left. |
(package private) static int |
LEFT
Indicates the left. |
(package private) static int |
LEFTBOTTOM
Indicates the right bottom. |
(package private) static int |
LEFTRIGHT
Indicates the left right. |
(package private) static int |
LEFTTOP
Indicates the left top. |
(package private) static int |
LESSER
Indicates the lesser. |
(package private) static int |
MAX
Indicates the maximum. |
(package private) static int |
MAXMODEL
Indicates the model or maximum model. |
(package private) static int |
MIN
Indicates the minimum. |
(package private) static int |
RIGHT
Indicates the right. |
(package private) static int |
RIGHTBOTTOM
Indicates the right bottom. |
(package private) static int |
RIGHTTOP
Indicates the right top. |
(package private) static int |
TOP
Indicates the top. |
(package private) static int |
TOPBOTTOM
Indicates the top bottom. |
(package private) static int |
VERTICAL
Indicates the vertical. |
(package private) static int |
WIDTH
Indicates the width. |
| Constructor Summary | |
(package private) |
Area()
Creates a new Area. |
| Method Summary | |
(package private) int |
applyRatio(int model,
float ratio)
Applies the given ratio to the given integer. |
(package private) boolean |
getAreaNeedsUpdate()
Indicates whether some property of this class has changed. |
(package private) boolean |
getAutoSize(int which)
Returns the auto sizing properties. |
(package private) java.awt.Color |
getBackgroundColor()
Returns the color of the background. |
(package private) boolean |
getBackgroundExistence()
Returns whether there exists a background or not. |
(package private) java.awt.Color |
getBorderColor()
Returns the color of the border (each border). |
(package private) java.awt.Color |
getBorderColor(int which)
Returns the color of the border (specific border). |
(package private) boolean |
getBorderExistence()
Gets whether there exists borders. |
(package private) boolean |
getBorderExistence(int which)
|
(package private) int |
getBorderThickness()
Returns the thickness of the border. |
(package private) int |
getBorderThickness(int which)
Returns the thickness of a border. |
(package private) int |
getBorderThicknessModel()
Gets the thickness of the border model. |
(package private) int |
getBorderThicknessModel(int which)
Gets the thickness of a border model. |
(package private) int |
getGapThickness()
Returns the thickness of one of the gaps. |
(package private) int |
getGapThicknessModel()
Gets the thickness of the gap model. |
(package private) int |
getJustifications(int which)
Returns the current justifications for the minimum area. |
(package private) float |
getRatio(int which)
Returns the specified ratio. |
(package private) boolean |
getResetAreaModel()
Returns whether the max model will be reset, in the next max sizing. |
(package private) java.awt.Dimension |
getSize(int which)
Returns the size of the area. |
(package private) java.awt.Point |
getSizeLocation(int which)
Returns the location of the area. |
(package private) java.awt.Dimension |
getSpaceSize(int which)
Returns the size of the space area. |
(package private) java.awt.Point |
getSpaceSizeLocation(int which)
Returns the space area location. |
(package private) void |
paintComponent(java.awt.Graphics2D g2D)
Paints this bordered area. |
(package private) void |
resetAreaModel(boolean reset)
Resets the model for this class. |
(package private) void |
setAutoJustifys(boolean horizontal,
boolean vertical)
Adjusts settings to enable/disable auto justification of a minimum area that is less than a maximum area. |
(package private) void |
setAutoSizes(boolean maxModel,
boolean min)
Adjusts the settings that allow automatic (or default) sizing. |
(package private) void |
setBackgroundColor(java.awt.Color color)
Adjusts the color of the background. |
(package private) void |
setBackgroundExistence(boolean existence)
Adjusts whether there exists a background or not. |
(package private) void |
setBorderAssociations(boolean leftRight,
boolean leftTop,
boolean leftBottom,
boolean rightTop,
boolean rightBottom,
boolean topBottom)
Associates border thicknesses with other border thicknesses. |
(package private) void |
setBorderColor(java.awt.Color color)
Sets the color of the border (each border). |
(package private) void |
setBorderColors(java.awt.Color left,
java.awt.Color right,
java.awt.Color top,
java.awt.Color bottom)
Sets the color of each border, individually. |
(package private) void |
setBorderCornerAssociations(int leftTop,
int leftBottom,
int rightTop,
int rightBottom)
Associates each corner with one border. |
(package private) void |
setBorderExistence(boolean existences)
Adjusts whether there exists borders. |
(package private) void |
setBorderExistences(boolean left,
boolean right,
boolean top,
boolean bottom)
Adjusts whether there exists borders, each individually. |
(package private) void |
setBorderThicknessModel(int thickness)
Adjusts the thickness of the border models. |
(package private) void |
setBorderThicknessModels(int left,
int right,
int top,
int bottom)
Adjusts the thickness of the border models. |
(package private) void |
setCustomRatio(int which,
boolean customize,
float ratio)
Specifies whether to customize a particular ratio, overriding the calculation of it. |
(package private) void |
setGapAssociations(boolean leftRight,
boolean leftTop,
boolean leftBottom,
boolean rightTop,
boolean rightBottom,
boolean topBottom)
Associates gap thicknesses with other gap thicknesses. |
(package private) void |
setGapExistence(boolean existence)
Adjusts whether there exists gaps. |
(package private) void |
setGapExistences(boolean left,
boolean right,
boolean top,
boolean bottom)
Adjusts whether there exists gaps, each individually. |
(package private) void |
setGapThicknessModel(int thickness)
Adjusts the thickness of the gap models. |
(package private) void |
setGapThicknessModels(int left,
int right,
int top,
int bottom)
Adjusts the thickness of the gap models. |
(package private) void |
setJustifications(int horizontal,
int vertical)
Adjusts the actual justifications of minimum areas that are less than maximum areas. |
(package private) void |
setLockRatios(boolean lock)
Makes such that the widh and the heighh ratios are the same as the lesser ratio. |
(package private) void |
setSize(int which,
java.awt.Dimension size)
Sets the sizes of the areas. |
(package private) void |
setSizeLocation(int which,
java.awt.Point location)
Sets the location of a size/area. |
(package private) void |
setSpaceSize(int which,
java.awt.Dimension size)
Sets the size of the space; that is the area less the borders and gaps. |
(package private) void |
setSpaceSizeLocation(int which,
java.awt.Point location)
Sets the location of an internal space area of a size area. |
(package private) void |
updateArea()
Updates this area. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
static final int MAX
static final int MAXMODEL
static final int MIN
static final int WIDTH
static final int HEIGHT
static final int LESSER
static final int LEFT
static final int RIGHT
static final int TOP
static final int BOTTOM
static final int CENTER
static final int LEFTRIGHT
static final int LEFTTOP
static final int LEFTBOTTOM
static final int RIGHTTOP
static final int RIGHTBOTTOM
static final int TOPBOTTOM
static final int HORIZONTAL
static final int VERTICAL
static final int CENTERED
static final int BETWEEN
static final int LABELSBOTTOM
static final int LABELSLEFT
static float[] CONTINUOUS
static float[] DASHED
static float[] DOTTED
static int FLOAT
static int INTEGER
| Constructor Detail |
Area()
| Method Detail |
void setSizeLocation(int which,
java.awt.Point location)
which - Which area to relocate. MAX is the only possible accepted
value.location - The new point of the top left of the area. The outer
edges of the left and top borders will touch this. Must not be null.
void setSpaceSizeLocation(int which,
java.awt.Point location)
which - Which space area to relocate. MIN is the only possible
value. If horizontal justification is true, then the x value will be
ignored. If vertical justification is true, then the y value will be
ignored.location - The new point of the top left of the space area. The
inner edges of the top and left gaps will touch this. Must not be null.
void setAutoJustifys(boolean horizontal,
boolean vertical)
horizontal - If true, then horizontal justification is
enabled.vertical - If true, then vertical justification is enabled.
void setJustifications(int horizontal,
int vertical)
horizontal - Sets the horizontal justification for the minimum
area. Possible values are LEFT, RIGHT and CENTER.vertical - Sets the vertical justification for the minimum
area. Possible values are LEFT, RIGHT and CENTER.
void setAutoSizes(boolean maxModel,
boolean min)
maxModel - If true, then the maximum model size will always
be equal to the maximum size. This disables growing because it keeps the
resizing ratios at 1. If false, then maximum model is constant; so if the
maximum size changes then the ratios will adjust accordingly.min - If true, then the minimum size will be kept equal to
the maximum size. This means that the borders' outer edges will touch
the maximum size.void setLockRatios(boolean lock)
lock - True causes all the ratios to equal the lesser ratio.
void setCustomRatio(int which,
boolean customize,
float ratio)
which - Which ratio to customize.customize - Whether to customize the ratio.ratio - The custom ratio.
void setSize(int which,
java.awt.Dimension size)
which - Which size to change. Possible values are MAX and
MAXMODEL.size - The new size. Must not be null.
void setSpaceSize(int which,
java.awt.Dimension size)
which - Which space size to change. Possible values are MIN.size - The new size. Must not be null.void setBackgroundExistence(boolean existence)
existence - If true, then there is.void setBackgroundColor(java.awt.Color color)
color - The color of the background.
void setBorderExistences(boolean left,
boolean right,
boolean top,
boolean bottom)
left - If true, then the left border does exist.right - If true, then the right border does exist.top - If true, then the top border does exist.bottom - If true, then the bottom border does exist.void setBorderExistence(boolean existences)
existences - If true, then the borders do not exist.
void setBorderThicknessModels(int left,
int right,
int top,
int bottom)
left - The model thickness for the left border.right - The model thickness for the right border.top - The model thickness for the top border.bottom - The model thickness for the bottom border.void setBorderThicknessModel(int thickness)
thickness - The model thickness for the border.
void setBorderCornerAssociations(int leftTop,
int leftBottom,
int rightTop,
int rightBottom)
leftTop - The border to associate with the leftTop corner.
Possible values are LEFT and TOP.rightTop - The border to associate with the rightTop corner.
Possible values are RIGHT and TOP.leftBottomThe - border to associate with the leftBottom corner.
Possible values are LEFT and BOTTOM.rightBottom - The border to associate with the rightBottom corner.
Possible values are RIGHT and BOTTOM.
void setBorderAssociations(boolean leftRight,
boolean leftTop,
boolean leftBottom,
boolean rightTop,
boolean rightBottom,
boolean topBottom)
leftRight - If true, then associates the left and right
borders.leftTop - If true, then associates the left and top borders.leftBottom - If true, then associates the left and bottom
borders.rightTop - If true, then associates the right and top borders.rightBottom - If true, then associates the right and bottom
borders.topBottom - If true, then associates the top and bottom
borders.
void setBorderColors(java.awt.Color left,
java.awt.Color right,
java.awt.Color top,
java.awt.Color bottom)
left - The color of the left border.right - The color of the right border.top - The color of the top border.bottom - The color of the bottom border.void setBorderColor(java.awt.Color color)
color - The color of the border.
void setGapExistences(boolean left,
boolean right,
boolean top,
boolean bottom)
left - If true, then the left gap does exist.right - If true, then the right gap does exist.top - If true, then the top gap does exist.bottom - If true, then the bottom gap does exist.void setGapExistence(boolean existence)
existence - If true, then the gap exists.
void setGapThicknessModels(int left,
int right,
int top,
int bottom)
left - The model thickness for the left gap.right - The model thickness for the right gap.top - The model thickness for the top gap.bottom - The model thickness for the bottom gap.void setGapThicknessModel(int thickness)
thickness - The model thickness for the gap.
void setGapAssociations(boolean leftRight,
boolean leftTop,
boolean leftBottom,
boolean rightTop,
boolean rightBottom,
boolean topBottom)
leftRight - If true, then associates the left and right gaps.leftTop - If true, then associates the left and top gaps.leftBottom - If true, then associates the left and bottom
gaps.rightTop - If true, then associates the right and top gaps.rightBottom - If true, then associates the right and bottom
gaps.topBottom - If true, then associates the top and bottom gaps.java.awt.Point getSpaceSizeLocation(int which)
which - Which space area location to return. Posible values are MAX
and MIN.boolean getAutoSize(int which)
which - Which auto size property to return. Possible values are
MAXMODEL and MIN.java.awt.Dimension getSize(int which)
which - Which size to return. Possible values are MAX, MAXMODEL, and
MIN.java.awt.Point getSizeLocation(int which)
which - Which size location to return. Possible values are MAX and MIN.java.awt.Dimension getSpaceSize(int which)
which - Which space area size to return. Possible values are MAX and
MIN.float getRatio(int which)
which - Which ratio to return. Possible values are WIDTH, HEIGHT, and
LESSER.int getJustifications(int which)
which - Which justification to return. Possible values are HORIZONTAL
and VERTICAL.boolean getBackgroundExistence()
java.awt.Color getBackgroundColor()
boolean getBorderExistence()
boolean getBorderExistence(int which)
java.awt.Color getBorderColor()
java.awt.Color getBorderColor(int which)
which - Which border you want the color of (BOTTOM, TOP, LEFT, RIGHT).int getGapThicknessModel()
int getGapThickness()
int getBorderThicknessModel()
int getBorderThicknessModel(int which)
int getBorderThickness(int which)
int getBorderThickness()
boolean getAreaNeedsUpdate()
int applyRatio(int model,
float ratio)
model - The integer.ratio - The ratio.boolean getResetAreaModel()
void updateArea()
void resetAreaModel(boolean reset)
reset - True causes the max model size to be set upon the next max
sizing.void paintComponent(java.awt.Graphics2D g2D)
g2D - The graphics context for calculations and painting.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||