Component.java 文件源码

java
阅读 32 收藏 0 点赞 0 评论 0

项目:cn1 作者:
/**
 * Update the component bounds and post the appropriate events
 */
void setBounds(int x, int y, int w, int h, int bMask, boolean updateBehavior) {
    int oldX = this.x;
    int oldY = this.y;
    int oldW = this.w;
    int oldH = this.h;
    setBoundsFields(x, y, w, h, bMask);
    // Moved
    if ((oldX != this.x) || (oldY != this.y)) {
        invalidateRealParent();
        postEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED));
        spreadHierarchyBoundsEvents(this, HierarchyEvent.ANCESTOR_MOVED);
    }
    // Resized
    if ((oldW != this.w) || (oldH != this.h)) {
        invalidate();
        postEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED));
        spreadHierarchyBoundsEvents(this, HierarchyEvent.ANCESTOR_RESIZED);
    }
    if (updateBehavior) {
        behaviour.setBounds(this.x, this.y, this.w, this.h, bMask);
    }
    notifyInputMethod(new Rectangle(x, y, w, h));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号