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


Java View.getChildAllocation方法代码示例

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


在下文中一共展示了View.getChildAllocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChildViewBounds

import javax.swing.text.View; //导入方法依赖的package包/类
/**
 * Returns the bounds of a child view as a rectangle, since
 * <code>View</code>s tend to use <code>Shape</code>.
 *
 * @param parent The parent view of the child whose bounds we're getting.
 * @param line The index of the child view.
 * @param editorRect Returned from the text area's
 *        <code>getVisibleEditorRect</code> method.
 * @return The child view's bounds.
 */
protected static final Rectangle getChildViewBounds(View parent, int line,
									Rectangle editorRect) {
	Shape alloc = parent.getChildAllocation(line, editorRect);
	if (alloc==null) {
		// WrappedSyntaxView can have this when made so small it's
		// no longer visible
		return new Rectangle();
	}
	return alloc instanceof Rectangle ? (Rectangle)alloc :
									alloc.getBounds();
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:22,代码来源:AbstractGutterComponent.java

示例2: printView

import javax.swing.text.View; //导入方法依赖的package包/类
private boolean printView(final Graphics2D graphics2D,
                          final Shape allocation, final View view) {
    boolean pageExists = false;
    final Rectangle clipRectangle = new Rectangle(0, 0, (int) (pageFormat
            .getImageableWidth() / SCALE), (int) clientHeight);
    Shape childAllocation;
    View childView;

    if (view.getViewCount() > 0) {
        for (int i = 0; i < view.getViewCount(); i++) {
            childAllocation = view.getChildAllocation(i, allocation);
            if (childAllocation != null) {
                childView = view.getView(i);
                if (printView(graphics2D, childAllocation, childView)) {
                    pageExists = true;
                }
            }
        }
    } else {
        if (allocation.getBounds().getMaxY() >= clipRectangle.getY()) {

            if (allocation.getBounds().getHeight() > clipRectangle
                    .getHeight()
                    && allocation.intersects(clipRectangle)) {
                paintView(graphics2D, view, allocation);
                pageExists = true;
            } else {
                if (allocation.getBounds().getY() >= clipRectangle.getY()) {
                    if (allocation.getBounds().getMaxY() <= clipRectangle
                            .getMaxY()) {
                        paintView(graphics2D, view, allocation);
                        pageExists = true;

                    } else {
                        if (allocation.getBounds().getY() < pageEndY) {
                            pageEndY = allocation.getBounds().getY();
                        }
                    }
                }
            }
        }
    }
    return pageExists;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:45,代码来源:HTMLPrintable.java


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