當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。