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