java.awt.event.HierarchyBoundsListener#javax.swing.event.AncestorListener源码实例Demo

下面列出了java.awt.event.HierarchyBoundsListener#javax.swing.event.AncestorListener 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk9   文件: JComponentOperator.java
/**
 * Maps {@code JComponent.addAncestorListener(AncestorListener)}
 * through queue
 */
public void addAncestorListener(final AncestorListener ancestorListener) {
    runMapping(new MapVoidAction("addAncestorListener") {
        @Override
        public void map() {
            ((JComponent) getSource()).addAncestorListener(ancestorListener);
        }
    });
}
 
源代码2 项目: openjdk-jdk9   文件: JComponentOperator.java
/**
 * Maps {@code JComponent.removeAncestorListener(AncestorListener)}
 * through queue
 */
public void removeAncestorListener(final AncestorListener ancestorListener) {
    runMapping(new MapVoidAction("removeAncestorListener") {
        @Override
        public void map() {
            ((JComponent) getSource()).removeAncestorListener(ancestorListener);
        }
    });
}
 
源代码3 项目: consulo   文件: ExpandableSupport.java
public ExpandableSupport(@Nonnull Source source, Function<? super String, String> onShow, Function<? super String, String> onHide) {
  this.source = source;
  this.onShow = onShow != null ? onShow : Function.ID;
  this.onHide = onHide != null ? onHide : Function.ID;
  source.putClientProperty(Expandable.class, this);
  source.addAncestorListener(create(AncestorListener.class, this, "collapse"));
  source.addComponentListener(create(ComponentListener.class, this, "collapse"));
}
 
源代码4 项目: netbeans   文件: HtmlRendererImpl.java
/** Overridden to do nothing for performance reasons */
public @Override void addAncestorListener(AncestorListener l) {
    if (swingRendering || !cellRenderer) {
        super.addAncestorListener(l);
    }
}
 
源代码5 项目: netbeans   文件: FindInQuerySupport.java
public AncestorListener getAncestorListener() {
    return ancestorListener;
}
 
源代码6 项目: seaglass   文件: WindowUtils.java
/**
 * Installs a {@link WindowFocusListener} on the given {@link JComponent}'s
 * parent {@link Window}. If the {@code JComponent} doesn't yet have a
 * parent, then the listener will be installed when the component is added
 * to a container.
 *
 * @param component     the component who's parent frame to listen to focus
 *                      changes on.
 * @param focusListener the {@code WindowFocusListener} to notify when focus
 *                      changes.
 */
public static void installWeakWindowFocusListener(JComponent component, WindowFocusListener focusListener) {
    WindowListener   weakFocusListener = createWeakWindowFocusListener(focusListener);
    AncestorListener ancestorListener  = createAncestorListener(component, weakFocusListener);

    component.addAncestorListener(ancestorListener);
}
 
源代码7 项目: seaglass   文件: WindowUtils.java
/**
 * Installs a listener on the given {@link JComponent}'s parent
 * {@link Window} that repaints the given component when the parent window's
 * focused state changes. If the given component does not have a parent at
 * the time this method is called, then an ancestor listener will be
 * installed that installs a window listener when the components parent
 * changes.
 *
 * @param component the {@code JComponent} to add the repaint focus listener
 *                  to.
 */
public static void installJComponentRepainterOnWindowFocusChanged(JComponent component) {
    // TODO check to see if the component already has an ancestor.
    WindowListener   windowListener   = createWeakWindowFocusListener(createRepaintWindowListener(component));
    AncestorListener ancestorListener = createAncestorListener(component, windowListener);

    component.addAncestorListener(ancestorListener);
}