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


Java ComponentPeer.applyShape方法代码示例

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


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

示例1: applyCompoundShape

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * Applies the shape to the component
 * @param shape Shape to be applied to the component
 */
void applyCompoundShape(Region shape) {
    checkTreeLock();

    if (!areBoundsValid()) {
        if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
            mixingLog.fine("this = " + this + "; areBoundsValid = " + areBoundsValid());
        }
        return;
    }

    if (!isLightweight()) {
        ComponentPeer peer = getPeer();
        if (peer != null) {
            // The Region class has some optimizations. That's why
            // we should manually check whether it's empty and
            // substitute the object ourselves. Otherwise we end up
            // with some incorrect Region object with loX being
            // greater than the hiX for instance.
            if (shape.isEmpty()) {
                shape = Region.EMPTY_REGION;
            }


            // Note: the shape is not really copied/cloned. We create
            // the Region object ourselves, so there's no any possibility
            // to modify the object outside of the mixing code.
            // Nullifying compoundShape means that the component has normal shape
            // (or has no shape at all).
            if (shape.equals(getNormalShape())) {
                if (this.compoundShape == null) {
                    return;
                }
                this.compoundShape = null;
                peer.applyShape(null);
            } else {
                if (shape.equals(getAppliedShape())) {
                    return;
                }
                this.compoundShape = shape;
                Point compAbsolute = getLocationOnWindow();
                if (mixingLog.isLoggable(PlatformLogger.Level.FINER)) {
                    mixingLog.fine("this = " + this +
                            "; compAbsolute=" + compAbsolute + "; shape=" + shape);
                }
                peer.applyShape(shape.getTranslatedRegion(-compAbsolute.x, -compAbsolute.y));
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:54,代码来源:Component.java

示例2: applyCompoundShape

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * Applies the shape to the component
 * @param shape Shape to be applied to the component
 */
void applyCompoundShape(Region shape) {
    checkTreeLock();

    if (!areBoundsValid()) {
        if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
            mixingLog.fine("this = " + this + "; areBoundsValid = " + areBoundsValid());
        }
        return;
    }

    if (!isLightweight()) {
        ComponentPeer peer = this.peer;
        if (peer != null) {
            // The Region class has some optimizations. That's why
            // we should manually check whether it's empty and
            // substitute the object ourselves. Otherwise we end up
            // with some incorrect Region object with loX being
            // greater than the hiX for instance.
            if (shape.isEmpty()) {
                shape = Region.EMPTY_REGION;
            }


            // Note: the shape is not really copied/cloned. We create
            // the Region object ourselves, so there's no any possibility
            // to modify the object outside of the mixing code.
            // Nullifying compoundShape means that the component has normal shape
            // (or has no shape at all).
            if (shape.equals(getNormalShape())) {
                if (this.compoundShape == null) {
                    return;
                }
                this.compoundShape = null;
                peer.applyShape(null);
            } else {
                if (shape.equals(getAppliedShape())) {
                    return;
                }
                this.compoundShape = shape;
                Point compAbsolute = getLocationOnWindow();
                if (mixingLog.isLoggable(PlatformLogger.Level.FINER)) {
                    mixingLog.fine("this = " + this +
                            "; compAbsolute=" + compAbsolute + "; shape=" + shape);
                }
                peer.applyShape(shape.getTranslatedRegion(-compAbsolute.x, -compAbsolute.y));
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:54,代码来源:Component.java


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