本文整理匯總了Java中org.jfree.ui.RectangleEdge.BOTTOM屬性的典型用法代碼示例。如果您正苦於以下問題:Java RectangleEdge.BOTTOM屬性的具體用法?Java RectangleEdge.BOTTOM怎麽用?Java RectangleEdge.BOTTOM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.jfree.ui.RectangleEdge
的用法示例。
在下文中一共展示了RectangleEdge.BOTTOM屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: calculateAnchorPoint
/**
* Calculates the anchor point for a tick label.
*
* @param tick the tick.
* @param cursor the cursor.
* @param dataArea the data area.
* @param edge the edge on which the axis is drawn.
*
* @return The x and y coordinates of the anchor point.
*/
protected float[] calculateAnchorPoint(ValueTick tick,
double cursor,
Rectangle2D dataArea,
RectangleEdge edge) {
RectangleInsets insets = getTickLabelInsets();
float[] result = new float[2];
if (edge == RectangleEdge.TOP) {
result[0] = (float) valueToJava2D(tick.getValue(), dataArea, edge);
result[1] = (float) (cursor - insets.getBottom() - 2.0);
}
else if (edge == RectangleEdge.BOTTOM) {
result[0] = (float) valueToJava2D(tick.getValue(), dataArea, edge);
result[1] = (float) (cursor + insets.getTop() + 2.0);
}
else if (edge == RectangleEdge.LEFT) {
result[0] = (float) (cursor - insets.getLeft() - 2.0);
result[1] = (float) valueToJava2D(tick.getValue(), dataArea, edge);
}
else if (edge == RectangleEdge.RIGHT) {
result[0] = (float) (cursor + insets.getRight() + 2.0);
result[1] = (float) valueToJava2D(tick.getValue(), dataArea, edge);
}
return result;
}
示例2: calculateCategorySize
/**
* Calculates the size (width or height, depending on the location of the
* axis) of a category.
*
* @param categoryCount the number of categories.
* @param area the area within which the categories will be drawn.
* @param edge the axis location.
*
* @return The category size.
*/
protected double calculateCategorySize(int categoryCount, Rectangle2D area,
RectangleEdge edge) {
double result = 0.0;
double available = 0.0;
if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
available = area.getWidth();
}
else if ((edge == RectangleEdge.LEFT)
|| (edge == RectangleEdge.RIGHT)) {
available = area.getHeight();
}
if (categoryCount > 1) {
result = available * (1 - getLowerMargin() - getUpperMargin()
- getCategoryMargin());
result = result / categoryCount;
}
else {
result = available * (1 - getLowerMargin() - getUpperMargin());
}
return result;
}
示例3: drawAxisLine
/**
* Draws an axis line at the current cursor position and edge.
*
* @param g2 the graphics device.
* @param cursor the cursor position.
* @param dataArea the data area.
* @param edge the edge.
*/
protected void drawAxisLine(Graphics2D g2, double cursor,
Rectangle2D dataArea, RectangleEdge edge) {
Line2D axisLine = null;
if (edge == RectangleEdge.TOP) {
axisLine = new Line2D.Double(dataArea.getX(), cursor,
dataArea.getMaxX(), cursor);
}
else if (edge == RectangleEdge.BOTTOM) {
axisLine = new Line2D.Double(dataArea.getX(), cursor,
dataArea.getMaxX(), cursor);
}
else if (edge == RectangleEdge.LEFT) {
axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor,
dataArea.getMaxY());
}
else if (edge == RectangleEdge.RIGHT) {
axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor,
dataArea.getMaxY());
}
g2.setPaint(this.axisLinePaint);
g2.setStroke(this.axisLineStroke);
g2.draw(axisLine);
}
示例4: add
/**
* Adds a block to the arrangement manager at the specified edge.
*
* @param block the block (<code>null</code> permitted).
* @param key the edge (an instance of {@link RectangleEdge}) or
* <code>null</code> for the center block.
*/
public void add(Block block, Object key) {
if (key == null) {
this.centerBlock = block;
}
else {
RectangleEdge edge = (RectangleEdge) key;
if (edge == RectangleEdge.TOP) {
this.topBlock = block;
}
else if (edge == RectangleEdge.BOTTOM) {
this.bottomBlock = block;
}
else if (edge == RectangleEdge.LEFT) {
this.leftBlock = block;
}
else if (edge == RectangleEdge.RIGHT) {
this.rightBlock = block;
}
}
}
示例5: drawAxisLine
/**
* Draws an axis line at the current cursor position and edge.
*
* @param g2 the graphics device.
* @param cursor the cursor position.
* @param dataArea the data area.
* @param edge the edge.
*/
protected void drawAxisLine(Graphics2D g2, double cursor,
Rectangle2D dataArea, RectangleEdge edge) {
Line2D axisLine = null;
if (edge == RectangleEdge.TOP) {
axisLine = new Line2D.Double(dataArea.getX(), cursor, dataArea.getMaxX(), cursor);
}
else if (edge == RectangleEdge.BOTTOM) {
axisLine = new Line2D.Double(dataArea.getX(), cursor, dataArea.getMaxX(), cursor);
}
else if (edge == RectangleEdge.LEFT) {
axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, dataArea.getMaxY());
}
else if (edge == RectangleEdge.RIGHT) {
axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor, dataArea.getMaxY());
}
g2.setPaint(this.axisLinePaint);
g2.setStroke(this.axisLineStroke);
g2.draw(axisLine);
}
示例6: calculateCategoryGapSize
/**
* Calculates the size (width or height, depending on the location of the axis) of a category
* gap.
*
* @param categoryCount the number of categories.
* @param area the area within which the categories will be drawn.
* @param edge the axis location.
*
* @return the category gap width.
*/
protected double calculateCategoryGapSize(int categoryCount, Rectangle2D area,
RectangleEdge edge) {
double result = 0.0;
double available = 0.0;
if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
available = area.getWidth();
}
else if ((edge == RectangleEdge.LEFT) || (edge == RectangleEdge.RIGHT)) {
available = area.getHeight();
}
if (categoryCount > 1) {
result = available * getCategoryMargin() / (categoryCount - 1);
}
return result;
}
示例7: calculateCategoryGapSize
/**
* Calculates the size (width or height, depending on the location of the
* axis) of a category gap.
*
* @param categoryCount the number of categories.
* @param area the area within which the categories will be drawn.
* @param edge the axis location.
*
* @return The category gap width.
*/
protected double calculateCategoryGapSize(int categoryCount,
Rectangle2D area,
RectangleEdge edge) {
double result = 0.0;
double available = 0.0;
if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
available = area.getWidth();
}
else if ((edge == RectangleEdge.LEFT)
|| (edge == RectangleEdge.RIGHT)) {
available = area.getHeight();
}
if (categoryCount > 1) {
result = available * getCategoryMargin() / (categoryCount - 1);
}
return result;
}
示例8: draw
/**
* Draws the title on a Java 2D graphics device (such as the screen or a printer).
*
* @param g2 the graphics device.
* @param titleArea the area within which the title (and plot) should be drawn.
*/
public void draw(Graphics2D g2, Rectangle2D titleArea) {
RectangleEdge position = getPosition();
if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) {
drawHorizontal(g2, titleArea);
}
else if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT) {
drawVertical(g2, titleArea);
}
else {
throw new RuntimeException("ImageTitle.draw(...) - invalid title position.");
}
}
示例9: draw
/**
* Draws the title on a Java 2D graphics device (such as the screen or a
* printer).
*
* @param g2 the graphics device.
* @param titleArea the area within which the title (and plot) should be
* drawn.
*/
public void draw(Graphics2D g2, Rectangle2D titleArea) {
RectangleEdge position = getPosition();
if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) {
drawHorizontal(g2, titleArea);
}
else if (position == RectangleEdge.LEFT
|| position == RectangleEdge.RIGHT) {
drawVertical(g2, titleArea);
}
else {
throw new RuntimeException("Invalid title position.");
}
}
示例10: ensureAtLeast
/**
* Ensures there is a minimum amount of space at the edge corresponding to
* the specified axis location.
*
* @param space the space.
* @param edge the location.
*/
public void ensureAtLeast(double space, RectangleEdge edge) {
if (edge == RectangleEdge.TOP) {
if (this.top < space) {
this.top = space;
}
}
else if (edge == RectangleEdge.BOTTOM) {
if (this.bottom < space) {
this.bottom = space;
}
}
else if (edge == RectangleEdge.LEFT) {
if (this.left < space) {
this.left = space;
}
}
else if (edge == RectangleEdge.RIGHT) {
if (this.right < space) {
this.right = space;
}
}
else {
throw new IllegalStateException(
"AxisSpace.ensureAtLeast(): unrecognised AxisLocation."
);
}
}
示例11: reserved
/**
* Calculates the reserved area.
*
* @param area the area.
* @param edge the edge.
*
* @return The reserved area.
*/
public Rectangle2D reserved(Rectangle2D area, RectangleEdge edge) {
Rectangle2D result = null;
if (edge == RectangleEdge.TOP) {
result = new Rectangle2D.Double(
area.getX(), area.getY(), area.getWidth(), this.top
);
}
else if (edge == RectangleEdge.BOTTOM) {
result = new Rectangle2D.Double(
area.getX(), area.getMaxY() - this.top,
area.getWidth(), this.bottom
);
}
else if (edge == RectangleEdge.LEFT) {
result = new Rectangle2D.Double(
area.getX(), area.getY(), this.left, area.getHeight()
);
}
else if (edge == RectangleEdge.RIGHT) {
result = new Rectangle2D.Double(
area.getMaxX() - this.right, area.getY(),
this.right, area.getHeight()
);
}
return result;
}
示例12: drawHorizontal
/**
* Draws a the title horizontally within the specified area. This method will be called
* from the {@link #draw(Graphics2D, Rectangle2D) draw} method.
*
* @param g2 the graphics device.
* @param area the area for the title.
*/
protected void drawHorizontal(Graphics2D g2, Rectangle2D area) {
Rectangle2D titleArea = (Rectangle2D) area.clone();
getSpacer().trim(titleArea);
g2.setFont(this.font);
g2.setPaint(this.paint);
TextBlock title = TextUtilities.createTextBlock(
this.text, this.font, this.paint, (float) titleArea.getWidth(), new G2TextMeasurer(g2)
);
TextBlockAnchor anchor = null;
float x = 0.0f;
HorizontalAlignment horizontalAlignment = getHorizontalAlignment();
if (horizontalAlignment == HorizontalAlignment.LEFT) {
x = (float) titleArea.getX();
anchor = TextBlockAnchor.TOP_LEFT;
}
else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
x = (float) titleArea.getMaxX();
anchor = TextBlockAnchor.TOP_RIGHT;
}
else if (horizontalAlignment == HorizontalAlignment.CENTER) {
x = (float) titleArea.getCenterX();
anchor = TextBlockAnchor.TOP_CENTER;
}
float y = 0.0f;
RectangleEdge position = getPosition();
if (position == RectangleEdge.TOP) {
y = (float) titleArea.getY();
}
else if (position == RectangleEdge.BOTTOM) {
y = (float) titleArea.getMaxY();
if (horizontalAlignment == HorizontalAlignment.LEFT) {
anchor = TextBlockAnchor.BOTTOM_LEFT;
}
else if (horizontalAlignment == HorizontalAlignment.CENTER) {
anchor = TextBlockAnchor.BOTTOM_CENTER;
}
else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
anchor = TextBlockAnchor.BOTTOM_RIGHT;
}
}
title.draw(g2, x, y, anchor);
}
示例13: getCategoryJava2DCoordinate
/**
* Returns the Java 2D coordinate for a category.
*
* @param anchor the anchor point.
* @param category the category index.
* @param categoryCount the category count.
* @param area the data area.
* @param edge the location of the axis.
*
* @return the coordinate.
*/
public double getCategoryJava2DCoordinate(CategoryAnchor anchor,
int category,
int categoryCount,
Rectangle2D area,
RectangleEdge edge) {
double result = 0.0;
Rectangle2D adjustedArea = area;
CategoryPlot plot = (CategoryPlot) getPlot();
CategoryItemRenderer renderer = plot.getRenderer();
if (renderer instanceof Effect3D) {
Effect3D e3D = (Effect3D) renderer;
double adjustedX = area.getMinX();
double adjustedY = area.getMinY();
double adjustedW = area.getWidth() - e3D.getXOffset();
double adjustedH = area.getHeight() - e3D.getYOffset();
if (edge == RectangleEdge.LEFT || edge == RectangleEdge.BOTTOM) {
adjustedY += e3D.getYOffset();
}
else if (edge == RectangleEdge.RIGHT || edge == RectangleEdge.TOP) {
adjustedX += e3D.getXOffset();
}
adjustedArea = new Rectangle2D.Double(
adjustedX, adjustedY, adjustedW, adjustedH
);
}
if (anchor == CategoryAnchor.START) {
result = getCategoryStart(category, categoryCount, adjustedArea, edge);
}
else if (anchor == CategoryAnchor.MIDDLE) {
result = getCategoryMiddle(category, categoryCount, adjustedArea, edge);
}
else if (anchor == CategoryAnchor.END) {
result = getCategoryEnd(category, categoryCount, adjustedArea, edge);
}
return result;
}
示例14: resolveRangeAxisLocation
/**
* Resolves a range axis location for a given plot orientation.
*
* @param location the location (<code>null</code> not permitted).
* @param orientation the orientation (<code>null</code> not permitted).
*
* @return The edge (never <code>null</code>).
*/
public static RectangleEdge resolveRangeAxisLocation(
AxisLocation location, PlotOrientation orientation) {
if (location == null) {
throw new IllegalArgumentException("Null 'location' argument.");
}
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
RectangleEdge result = null;
if (location == AxisLocation.TOP_OR_RIGHT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.TOP;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.RIGHT;
}
}
else if (location == AxisLocation.TOP_OR_LEFT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.TOP;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.LEFT;
}
}
else if (location == AxisLocation.BOTTOM_OR_RIGHT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.BOTTOM;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.RIGHT;
}
}
else if (location == AxisLocation.BOTTOM_OR_LEFT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.BOTTOM;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.LEFT;
}
}
// the above should cover all the options...
if (result == null) {
throw new IllegalStateException("resolveRangeAxisLocation()");
}
return result;
}
示例15: draw
/**
* Draws the axis on a Java 2D graphics device (such as the screen or a
* printer).
*
* @param g2 the graphics device.
* @param cursor the cursor.
* @param plotArea the area for drawing the axes and data.
* @param dataArea the area for drawing the data (a subset of the
* plotArea).
* @param edge the axis location.
* @param plotState collects information about the plot (<code>null</code>
* permitted).
*
* @return The updated cursor value.
*/
public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea,
Rectangle2D dataArea, RectangleEdge edge,
PlotRenderingInfo plotState) {
// if the axis is not visible, don't draw it...
if (!isVisible()) {
AxisState state = new AxisState(cursor);
// even though the axis is not visible, we need ticks for the
// gridlines...
List ticks = refreshTicks(g2, state, dataArea, edge);
state.setTicks(ticks);
return state;
}
// calculate the adjusted data area taking into account the 3D effect...
double xOffset = 0.0;
double yOffset = 0.0;
Plot plot = getPlot();
if (plot instanceof CategoryPlot) {
CategoryPlot cp = (CategoryPlot) plot;
CategoryItemRenderer r = cp.getRenderer();
if (r instanceof Effect3D) {
Effect3D e3D = (Effect3D) r;
xOffset = e3D.getXOffset();
yOffset = e3D.getYOffset();
}
}
double adjustedX = dataArea.getMinX();
double adjustedY = dataArea.getMinY();
double adjustedW = dataArea.getWidth() - xOffset;
double adjustedH = dataArea.getHeight() - yOffset;
if (edge == RectangleEdge.LEFT || edge == RectangleEdge.BOTTOM) {
adjustedY += yOffset;
}
else if (edge == RectangleEdge.RIGHT || edge == RectangleEdge.TOP) {
adjustedX += xOffset;
}
Rectangle2D adjustedDataArea = new Rectangle2D.Double(adjustedX,
adjustedY, adjustedW, adjustedH);
// draw the tick marks and labels...
AxisState info = drawTickMarksAndLabels(g2, cursor, plotArea,
adjustedDataArea, edge);
// draw the axis label...
info = drawLabel(getLabel(), g2, plotArea, dataArea, edge, info);
return info;
}