当前位置: 首页>>代码示例>>Java>>正文


Java RectangleInsets.calculateLeftOutset方法代码示例

本文整理汇总了Java中org.jfree.ui.RectangleInsets.calculateLeftOutset方法的典型用法代码示例。如果您正苦于以下问题:Java RectangleInsets.calculateLeftOutset方法的具体用法?Java RectangleInsets.calculateLeftOutset怎么用?Java RectangleInsets.calculateLeftOutset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.ui.RectangleInsets的用法示例。


在下文中一共展示了RectangleInsets.calculateLeftOutset方法的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);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:54,代码来源:ImageTitle.java

示例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);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:58,代码来源:ImageTitle.java


注:本文中的org.jfree.ui.RectangleInsets.calculateLeftOutset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。