本文整理汇总了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));
}
}
}
}
示例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));
}
}
}
}