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


Java ComponentPeer.setEnabled方法代码示例

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


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

示例1: enable

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>setEnabled(boolean)</code>.
 */
@Deprecated
public void enable() {
    if (!enabled) {
        synchronized (getTreeLock()) {
            enabled = true;
            ComponentPeer peer = this.peer;
            if (peer != null) {
                peer.setEnabled(true);
                if (visible) {
                    updateCursorImmediately();
                }
            }
        }
        if (accessibleContext != null) {
            accessibleContext.firePropertyChange(
                                                 AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                                                 null, AccessibleState.ENABLED);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:Component.java

示例2: enable

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>setEnabled(boolean)</code>.
 */
@Deprecated
public void enable() {
    if (!enabled) {
        synchronized (getTreeLock()) {
            enabled = true;
            ComponentPeer peer = this.peer;
            if (peer != null) {
                peer.setEnabled(true);
                if (visible && !getRecursivelyVisibleBounds().isEmpty()) {
                    updateCursorImmediately();
                }
            }
        }
        if (accessibleContext != null) {
            accessibleContext.firePropertyChange(
                                                 AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                                                 null, AccessibleState.ENABLED);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:Component.java

示例3: enable

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * @deprecated As of JDK version 1.1,
 * replaced by {@code setEnabled(boolean)}.
 */
@Deprecated
public void enable() {
    if (!enabled) {
        synchronized (getTreeLock()) {
            enabled = true;
            ComponentPeer peer = this.peer;
            if (peer != null) {
                peer.setEnabled(true);
                if (visible && !getRecursivelyVisibleBounds().isEmpty()) {
                    updateCursorImmediately();
                }
            }
        }
        if (accessibleContext != null) {
            accessibleContext.firePropertyChange(
                                                 AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                                                 null, AccessibleState.ENABLED);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:Component.java

示例4: disable

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>setEnabled(boolean)</code>.
 */
@Deprecated
public void disable() {
    if (enabled) {
        KeyboardFocusManager.clearMostRecentFocusOwner(this);
        synchronized (getTreeLock()) {
            enabled = false;
            // A disabled lw container is allowed to contain a focus owner.
            if ((isFocusOwner() || (containsFocus() && !isLightweight())) &&
                KeyboardFocusManager.isAutoFocusTransferEnabled())
            {
                // Don't clear the global focus owner. If transferFocus
                // fails, we want the focus to stay on the disabled
                // Component so that keyboard traversal, et. al. still
                // makes sense to the user.
                transferFocus(false);
            }
            ComponentPeer peer = this.peer;
            if (peer != null) {
                peer.setEnabled(false);
                if (visible) {
                    updateCursorImmediately();
                }
            }
        }
        if (accessibleContext != null) {
            accessibleContext.firePropertyChange(
                                                 AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                                                 null, AccessibleState.ENABLED);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:Component.java

示例5: setEnabled

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * @see java.awt.peer.ComponentPeer
 */
public void setEnabled(final boolean value) {
    if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
        enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
    }
    boolean status = value;
    // If any of our heavyweight ancestors are disable, we should be too
    // See 6176875 for more information
    final Container cp = SunToolkit.getNativeContainer(target);
    if (cp != null) {
        status &= ((XComponentPeer) cp.getPeer()).isEnabled();
    }
    synchronized (getStateLock()) {
        if (enabled == status) {
            return;
        }
        enabled = status;
    }

    if (target instanceof Container) {
        final Component[] list = ((Container) target).getComponents();
        for (final Component child : list) {
            final ComponentPeer p = child.getPeer();
            if (p != null) {
                p.setEnabled(status && child.isEnabled());
            }
        }
    }
    repaint();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:XComponentPeer.java

示例6: disable

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * @deprecated As of JDK version 1.1,
 * replaced by <code>setEnabled(boolean)</code>.
 */
@Deprecated
public void disable() {
    if (enabled) {
        KeyboardFocusManager.clearMostRecentFocusOwner(this);
        synchronized (getTreeLock()) {
            enabled = false;
            // A disabled lw container is allowed to contain a focus owner.
            if ((isFocusOwner() || (containsFocus() && !isLightweight())) &&
                KeyboardFocusManager.isAutoFocusTransferEnabled())
            {
                // Don't clear the global focus owner. If transferFocus
                // fails, we want the focus to stay on the disabled
                // Component so that keyboard traversal, et. al. still
                // makes sense to the user.
                transferFocus(false);
            }
            ComponentPeer peer = this.peer;
            if (peer != null) {
                peer.setEnabled(false);
                if (visible && !getRecursivelyVisibleBounds().isEmpty()) {
                    updateCursorImmediately();
                }
            }
        }
        if (accessibleContext != null) {
            accessibleContext.firePropertyChange(
                                                 AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                                                 null, AccessibleState.ENABLED);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:36,代码来源:Component.java

示例7: disable

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * @deprecated As of JDK version 1.1,
 * replaced by {@code setEnabled(boolean)}.
 */
@Deprecated
public void disable() {
    if (enabled) {
        KeyboardFocusManager.clearMostRecentFocusOwner(this);
        synchronized (getTreeLock()) {
            enabled = false;
            // A disabled lw container is allowed to contain a focus owner.
            if ((isFocusOwner() || (containsFocus() && !isLightweight())) &&
                KeyboardFocusManager.isAutoFocusTransferEnabled())
            {
                // Don't clear the global focus owner. If transferFocus
                // fails, we want the focus to stay on the disabled
                // Component so that keyboard traversal, et. al. still
                // makes sense to the user.
                transferFocus(false);
            }
            ComponentPeer peer = this.peer;
            if (peer != null) {
                peer.setEnabled(false);
                if (visible && !getRecursivelyVisibleBounds().isEmpty()) {
                    updateCursorImmediately();
                }
            }
        }
        if (accessibleContext != null) {
            accessibleContext.firePropertyChange(
                                                 AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                                                 null, AccessibleState.ENABLED);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:Component.java

示例8: setEnabled

import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
 * @see java.awt.peer.ComponentPeer
 */
public void setEnabled(final boolean value) {
    if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
        enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
    }
    boolean status = value;
    // If any of our heavyweight ancestors are disable, we should be too
    // See 6176875 for more information
    final Container cp = SunToolkit.getNativeContainer(target);
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if (cp != null) {
        status &= acc.<XComponentPeer>getPeer(cp).isEnabled();
    }
    synchronized (getStateLock()) {
        if (enabled == status) {
            return;
        }
        enabled = status;
    }

    if (target instanceof Container) {
        final Component[] list = ((Container) target).getComponents();
        for (final Component child : list) {
            final ComponentPeer p = acc.getPeer(child);
            if (p != null) {
                p.setEnabled(status && child.isEnabled());
            }
        }
    }
    repaint();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:XComponentPeer.java


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