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


Java HierarchyEvent.HIERARCHY_CHANGED属性代码示例

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


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

示例1: processEvent

/**
 * Processes the specified event. In this class, this method simply
 * calls one of the more specific event handlers.
 *
 * @param e the event to process
 * @throws NullPointerException if e is null
 * @see #processComponentEvent(ComponentEvent)
 * @see #processFocusEvent(FocusEvent)
 * @see #processKeyEvent(KeyEvent)
 * @see #processMouseEvent(MouseEvent)
 * @see #processMouseMotionEvent(MouseEvent)
 * @see #processInputMethodEvent(InputMethodEvent)
 * @see #processHierarchyEvent(HierarchyEvent)
 * @see #processMouseWheelEvent(MouseWheelEvent)
 * @since 1.1
 */
protected void processEvent(AWTEvent e)
{
  /* Note: the order of these if statements are
     important. Subclasses must be checked first. Eg. MouseEvent
     must be checked before ComponentEvent, since a MouseEvent
     object is also an instance of a ComponentEvent. */

  if (e instanceof FocusEvent)
    processFocusEvent((FocusEvent) e);
  else if (e instanceof MouseWheelEvent)
    processMouseWheelEvent((MouseWheelEvent) e);
  else if (e instanceof MouseEvent)
    {
      if (e.id == MouseEvent.MOUSE_MOVED
          || e.id == MouseEvent.MOUSE_DRAGGED)
        processMouseMotionEvent((MouseEvent) e);
      else
        processMouseEvent((MouseEvent) e);
    }
  else if (e instanceof KeyEvent)
    processKeyEvent((KeyEvent) e);
  else if (e instanceof InputMethodEvent)
    processInputMethodEvent((InputMethodEvent) e);
  else if (e instanceof ComponentEvent)
    processComponentEvent((ComponentEvent) e);
  else if (e instanceof HierarchyEvent)
    {
      if (e.id == HierarchyEvent.HIERARCHY_CHANGED)
        processHierarchyEvent((HierarchyEvent) e);
      else
        processHierarchyBoundsEvent((HierarchyEvent) e);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:49,代码来源:Component.java

示例2: fireHierarchyEvent

/**
 * Fires hierarchy events to the children of this container and this
 * container itself. This overrides {@link Component#fireHierarchyEvent}
 * in order to forward this event to all children.
 */
void fireHierarchyEvent(int id, Component changed, Container parent,
                        long flags)
{
  // Only propagate event if there is actually a listener waiting for it.
  if ((id == HierarchyEvent.HIERARCHY_CHANGED && numHierarchyListeners > 0)
      || ((id == HierarchyEvent.ANCESTOR_MOVED
           || id == HierarchyEvent.ANCESTOR_RESIZED)
          && numHierarchyBoundsListeners > 0))
    {
      for (int i = 0; i < ncomponents; i++)
        component[i].fireHierarchyEvent(id, changed, parent, flags);
      super.fireHierarchyEvent(id, changed, parent, flags);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:19,代码来源:Container.java

示例3: processHierarchyEvent

protected void processHierarchyEvent(HierarchyEvent e) {
    for (HierarchyListener listener : hierarchyListeners.getUserListeners()) {
        switch (e.getID()) {
            case HierarchyEvent.HIERARCHY_CHANGED:
                listener.hierarchyChanged(e);
                break;
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:Component.java

示例4: hierarchyChanged

public void hierarchyChanged(HierarchyEvent e) {
    if (((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0)
            || ((e.getChangeFlags() & HierarchyEvent.HIERARCHY_CHANGED) != 0)) {
        fireAncestorEvent(isShowing() ? AncestorEvent.ANCESTOR_ADDED
                : AncestorEvent.ANCESTOR_REMOVED, (Container) e.getChanged(), e
                .getChangedParent());
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:JComponent.java

示例5: eventTypeEnabled

/**
 * Tells whether or not an event type is enabled.
 */
boolean eventTypeEnabled (int type)
{
  if (type > AWTEvent.RESERVED_ID_MAX)
    return true;

  switch (type)
    {
    case HierarchyEvent.HIERARCHY_CHANGED:
      return (hierarchyListener != null
          || (eventMask & AWTEvent.HIERARCHY_EVENT_MASK) != 0);

    case HierarchyEvent.ANCESTOR_MOVED:
    case HierarchyEvent.ANCESTOR_RESIZED:
      return (hierarchyBoundsListener != null
          || (eventMask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0);

    case ComponentEvent.COMPONENT_HIDDEN:
    case ComponentEvent.COMPONENT_MOVED:
    case ComponentEvent.COMPONENT_RESIZED:
    case ComponentEvent.COMPONENT_SHOWN:
      return (componentListener != null
              || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0);

    case KeyEvent.KEY_PRESSED:
    case KeyEvent.KEY_RELEASED:
    case KeyEvent.KEY_TYPED:
      return (keyListener != null
              || (eventMask & AWTEvent.KEY_EVENT_MASK) != 0);

    case MouseEvent.MOUSE_CLICKED:
    case MouseEvent.MOUSE_ENTERED:
    case MouseEvent.MOUSE_EXITED:
    case MouseEvent.MOUSE_PRESSED:
    case MouseEvent.MOUSE_RELEASED:
      return (mouseListener != null
              || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0);
    case MouseEvent.MOUSE_MOVED:
    case MouseEvent.MOUSE_DRAGGED:
      return (mouseMotionListener != null
              || (eventMask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0);
    case MouseEvent.MOUSE_WHEEL:
      return (mouseWheelListener != null
              || (eventMask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0);

    case FocusEvent.FOCUS_GAINED:
    case FocusEvent.FOCUS_LOST:
      return (focusListener != null
              || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0);

    case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
    case InputMethodEvent.CARET_POSITION_CHANGED:
      return (inputMethodListener != null
              || (eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0);

    case PaintEvent.PAINT:
    case PaintEvent.UPDATE:
      return (eventMask & AWTEvent.PAINT_EVENT_MASK) != 0;

    default:
      return false;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:65,代码来源:Component.java

示例6: eventTypeEnabled

/**
 * Tells whether or not an event type is enabled.
 */
boolean eventTypeEnabled (int type)
{
  if (type > AWTEvent.RESERVED_ID_MAX)
    return true;

  switch (type)
    {
    case HierarchyEvent.HIERARCHY_CHANGED:
      return (hierarchyListener != null 
          || (eventMask & AWTEvent.HIERARCHY_EVENT_MASK) != 0);
      
    case HierarchyEvent.ANCESTOR_MOVED:
    case HierarchyEvent.ANCESTOR_RESIZED:
      return (hierarchyBoundsListener != null 
          || (eventMask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0);
      
    case ComponentEvent.COMPONENT_HIDDEN:
    case ComponentEvent.COMPONENT_MOVED:
    case ComponentEvent.COMPONENT_RESIZED:
    case ComponentEvent.COMPONENT_SHOWN:
      return (componentListener != null
              || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0);

    case KeyEvent.KEY_PRESSED:
    case KeyEvent.KEY_RELEASED:
    case KeyEvent.KEY_TYPED:
      return (keyListener != null
              || (eventMask & AWTEvent.KEY_EVENT_MASK) != 0);

    case MouseEvent.MOUSE_CLICKED:
    case MouseEvent.MOUSE_ENTERED:
    case MouseEvent.MOUSE_EXITED:
    case MouseEvent.MOUSE_PRESSED:
    case MouseEvent.MOUSE_RELEASED:
      return (mouseListener != null
              || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0);
    case MouseEvent.MOUSE_MOVED:
    case MouseEvent.MOUSE_DRAGGED:
      return (mouseMotionListener != null
              || (eventMask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0);
    case MouseEvent.MOUSE_WHEEL:
      return (mouseWheelListener != null
              || (eventMask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0);
      
    case FocusEvent.FOCUS_GAINED:
    case FocusEvent.FOCUS_LOST:
      return (focusListener != null
              || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0);

    case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
    case InputMethodEvent.CARET_POSITION_CHANGED:
      return (inputMethodListener != null
              || (eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0);
      
    case PaintEvent.PAINT:
    case PaintEvent.UPDATE:
      return (eventMask & AWTEvent.PAINT_EVENT_MASK) != 0;
      
    default:
      return false;
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:65,代码来源:Component.java

示例7: isParentChange

private boolean isParentChange(HierarchyEvent evt) {
    if(evt.getID()!=HierarchyEvent.HIERARCHY_CHANGED || evt.getChangeFlags()!=HierarchyEvent.PARENT_CHANGED)
        return false;
    return true;
}
 
开发者ID:humphrej,项目名称:flexdock,代码行数:5,代码来源:DockingPortTracker.java

示例8: processHierarchyEvent

/**
 * Called when a hierarchy change event is dispatched and component events
 * are enabled. This method passes the event along to any listeners that are
 * attached.
 *
 * @param e the <code>HierarchyEvent</code> to process
 * @throws NullPointerException if e is null
 * @see HierarchyListener
 * @see #addHierarchyListener(HierarchyListener)
 * @see #enableEvents(long)
 * @since 1.3
 */
protected void processHierarchyEvent(HierarchyEvent e)
{
  if (hierarchyListener == null)
    return;
  if (e.id == HierarchyEvent.HIERARCHY_CHANGED)
    hierarchyListener.hierarchyChanged(e);
}
 
开发者ID:vilie,项目名称:javify,代码行数:19,代码来源:Component.java


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