本文整理汇总了Java中org.jfree.ui.RectangleInsets.calculateTopOutset方法的典型用法代码示例。如果您正苦于以下问题:Java RectangleInsets.calculateTopOutset方法的具体用法?Java RectangleInsets.calculateTopOutset怎么用?Java RectangleInsets.calculateTopOutset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.ui.RectangleInsets
的用法示例。
在下文中一共展示了RectangleInsets.calculateTopOutset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawHorizontal
import org.jfree.ui.RectangleInsets; //导入方法依赖的package包/类
/**
* Draws the title on a Java 2D graphics device (such as the screen or a
* printer).
*
* @param g2 the graphics device.
* @param chartArea the area within which the title (and plot) should be
* drawn.
*
* @return The size of the area used by the title.
*/
protected Size2D drawHorizontal(Graphics2D g2, Rectangle2D chartArea) {
double startY = 0.0;
double topSpace = 0.0;
double bottomSpace = 0.0;
double leftSpace = 0.0;
double rightSpace = 0.0;
double w = getWidth();
double h = getHeight();
RectangleInsets padding = getPadding();
topSpace = padding.calculateTopOutset(h);
bottomSpace = padding.calculateBottomOutset(h);
leftSpace = padding.calculateLeftOutset(w);
rightSpace = padding.calculateRightOutset(w);
if (getPosition() == RectangleEdge.TOP) {
startY = chartArea.getY() + topSpace;
}
else {
startY = chartArea.getY() + chartArea.getHeight() - bottomSpace - h;
}
// what is our alignment?
HorizontalAlignment horizontalAlignment = getHorizontalAlignment();
double startX = 0.0;
if (horizontalAlignment == HorizontalAlignment.CENTER) {
startX = chartArea.getX() + leftSpace + chartArea.getWidth() / 2.0
- w / 2.0;
}
else if (horizontalAlignment == HorizontalAlignment.LEFT) {
startX = chartArea.getX() + leftSpace;
}
else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
startX = chartArea.getX() + chartArea.getWidth() - rightSpace - w;
}
g2.drawImage(this.image, (int) startX, (int) startY, (int) w, (int) h,
null);
return new Size2D(chartArea.getWidth() + leftSpace + rightSpace,
h + topSpace + bottomSpace);
}
示例2: drawVertical
import org.jfree.ui.RectangleInsets; //导入方法依赖的package包/类
/**
* Draws the title on a Java 2D graphics device (such as the screen or a
* printer).
*
* @param g2 the graphics device.
* @param chartArea the area within which the title (and plot) should be
* drawn.
*
* @return The size of the area used by the title.
*/
protected Size2D drawVertical(Graphics2D g2, Rectangle2D chartArea) {
double startX = 0.0;
double topSpace = 0.0;
double bottomSpace = 0.0;
double leftSpace = 0.0;
double rightSpace = 0.0;
double w = getWidth();
double h = getHeight();
RectangleInsets padding = getPadding();
if (padding != null) {
topSpace = padding.calculateTopOutset(h);
bottomSpace = padding.calculateBottomOutset(h);
leftSpace = padding.calculateLeftOutset(w);
rightSpace = padding.calculateRightOutset(w);
}
if (getPosition() == RectangleEdge.LEFT) {
startX = chartArea.getX() + leftSpace;
}
else {
startX = chartArea.getMaxX() - rightSpace - w;
}
// what is our alignment?
VerticalAlignment alignment = getVerticalAlignment();
double startY = 0.0;
if (alignment == VerticalAlignment.CENTER) {
startY = chartArea.getMinY() + topSpace
+ chartArea.getHeight() / 2.0 - h / 2.0;
}
else if (alignment == VerticalAlignment.TOP) {
startY = chartArea.getMinY() + topSpace;
}
else if (alignment == VerticalAlignment.BOTTOM) {
startY = chartArea.getMaxY() - bottomSpace - h;
}
g2.drawImage(this.image, (int) startX, (int) startY, (int) w, (int) h,
null);
return new Size2D(chartArea.getWidth() + leftSpace + rightSpace,
h + topSpace + bottomSpace);
}