模块 java.desktop

类 AncestorEvent

所有已实现的接口:
Serializable

public class AncestorEvent extends AWTEvent
向源自组件层次结构中的祖先的子组件报告的事件。

Warning: 此类的序列化对象将与未来的 Swing 版本不兼容。当前的序列化支持适用于运行相同版本 Swing 的应用程序之间的短期存储或 RMI。从 1.4 开始,对所有 JavaBeans 的长期存储的支持已添加到 java.beans 包中。请参阅 XMLEncoder

  • 字段详细信息

    • ANCESTOR_ADDED

      public static final int ANCESTOR_ADDED
      祖先组件已添加到可见对象的层次结构中(使其可见),并且当前正在显示。
      参见:
    • ANCESTOR_REMOVED

      public static final int ANCESTOR_REMOVED
      祖先组件已从可见对象的层次结构中删除(隐藏)并且不再显示。
      参见:
    • ANCESTOR_MOVED

      public static final int ANCESTOR_MOVED
      祖先组件改变了它在屏幕上的位置。
      参见:
  • 构造方法详细信息

    • AncestorEvent

      public AncestorEvent(JComponent  source, int id, Container  ancestor, Container  ancestorParent)
      构造一个 AncestorEvent 对象以标识祖先组件显示状态的更改。
      参数:
      source - 发起事件的 JComponent(通常为 this
      id - 指定 ANCESTOR_ADDED ANCESTOR_REMOVED ANCESTOR_MOVED 的 int
      ancestor - 指定显示状态已更改的祖先组件的容器对象
      ancestorParent - 指定祖先父级的容器对象
  • 方法详情

    • getAncestor

      public Container  getAncestor()
      返回事件实际发生的祖先。
      返回:
      指定祖先组件的 Container 对象
    • getAncestorParent

      public Container  getAncestorParent()
      返回事件实际发生的祖先的父级。这在 ANCESTOR_REMOVED 事件中最为有趣,因为祖先可能不再位于组件层次结构中。
      返回:
      指定祖先父级的 Container 对象
    • getComponent

      public JComponent  getComponent()
      返回添加了监听的组件。
      返回:
      事件发生的JComponent