Java Code Examples for javax.swing.SwingUtilities#getAncestorNamed()

The following examples show how to use javax.swing.SwingUtilities#getAncestorNamed() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans   File: PopupUtil.java    License: Apache License 2.0 6 votes vote down vote up
public void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent)aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            //#118828
            if (! (aWTEvent.getSource() instanceof Component)) {
                hidePopup();
                return;
            }
            
            Component comp = (Component)aWTEvent.getSource();
            Container par = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N
            // Container barpar = SwingUtilities.getAncestorOfClass(PopupUtil.class, comp);
            // if (par == null && barpar == null) {
            if ( par == null ) {
                hidePopup();
            }
        }
    }
}
 
Example 2
Source Project: netbeans   File: StatusLineComponent.java    License: Apache License 2.0 6 votes vote down vote up
public @Override void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent)aWTEvent;
        if (mv.getClickCount() > 0) {
            //#118828
            if (! (aWTEvent.getSource() instanceof Component)) {
                return;
            }
            Component comp = (Component)aWTEvent.getSource();
            Container par = SwingUtilities.getAncestorNamed("progresspopup", comp); //NOI18N
            Container barpar = SwingUtilities.getAncestorOfClass(StatusLineComponent.class, comp);
            if (par == null && barpar == null) {
                hidePopup();
            }
        }
    }
}
 
Example 3
Source Project: netbeans   File: PopupUtil.java    License: Apache License 2.0 6 votes vote down vote up
public void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent)aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            //#118828
            if (! (aWTEvent.getSource() instanceof Component)) {
                hidePopup();
                return;
            }
            
            Component comp = (Component)aWTEvent.getSource();
            Container par = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N
            if ( par == null ) {
                hidePopup();
            }
        }
    }
}
 
Example 4
@Override
public void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent) aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            if (!(aWTEvent.getSource() instanceof Component)) {
                hide();
                return;
            }
            
            Component comp = (Component) aWTEvent.getSource();
            Container par = SwingUtilities.getAncestorNamed(POPUP_NAME, comp);
            if (par == null) {
                hide();
            }
        }
    }
}
 
Example 5
Source Project: netbeans   File: PopupUtil.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent) aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            //#118828
            if (!(aWTEvent.getSource() instanceof Component)) {
                hidePopup();
                return;
            }

            Component comp = (Component) aWTEvent.getSource();
            Container par = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N
            // Container barpar = SwingUtilities.getAncestorOfClass(PopupUtil.class, comp);
            // if (par == null && barpar == null) {
            if (par == null) {
                hidePopup();
            }
        }
    }
}
 
Example 6
Source Project: netbeans   File: HintsUI.java    License: Apache License 2.0 6 votes vote down vote up
public void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent)aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            //#118828
            if (! (aWTEvent.getSource() instanceof Component)) {
                removePopup();
                return;
            }
            
            Component comp = (Component)aWTEvent.getSource();
            Container par1 = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N
            Container par2 = SwingUtilities.getAncestorNamed(SUB_POPUP_NAME, comp); //NOI18N
            // Container barpar = SwingUtilities.getAncestorOfClass(PopupUtil.class, comp);
            // if (par == null && barpar == null) {
            if ( par1 == null && par2 == null ) {
                removePopup();
            }
        }
    }
}
 
Example 7
Source Project: netbeans   File: PopupUtil.java    License: Apache License 2.0 6 votes vote down vote up
public void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent)aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            //#118828
            if (! (aWTEvent.getSource() instanceof Component)) {
                hidePopup();
                return;
            }
            
            Component comp = (Component)aWTEvent.getSource();
            Container par = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N
            // Container barpar = SwingUtilities.getAncestorOfClass(PopupUtil.class, comp);
            // if (par == null && barpar == null) {
            if ( par == null ) {
                hidePopup();
            }
        }
    }
}
 
Example 8
Source Project: netbeans   File: PopupUtil.java    License: Apache License 2.0 6 votes vote down vote up
public void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent)aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            //#118828
            if (! (aWTEvent.getSource() instanceof Component)) {
                hidePopup();
                return;
            }
            
            Component comp = (Component)aWTEvent.getSource();
            Container par = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N
            // Container barpar = SwingUtilities.getAncestorOfClass(PopupUtil.class, comp);
            // if (par == null && barpar == null) {
            if ( par == null ) {
                hidePopup();
            }
        }
    }
}
 
Example 9
Source Project: netbeans   File: CompletionLayoutPopup.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void eventDispatched(AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent) aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            //#118828
            if (!(aWTEvent.getSource() instanceof Component)) {
                hide();
                return;
            }

            Component comp = (Component) aWTEvent.getSource();
            Container par1 = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N
            if (par1 == null) {
                hide();
            }
        }
    }
}
 
Example 10
Source Project: netbeans   File: PopupUtil.java    License: Apache License 2.0 6 votes vote down vote up
public void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent)aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            //#118828
            if (! (aWTEvent.getSource() instanceof Component)) {
                hidePopup();
                return;
            }
            
            Component comp = (Component)aWTEvent.getSource();
            Container par = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N
            // Container barpar = SwingUtilities.getAncestorOfClass(PopupUtil.class, comp);
            // if (par == null && barpar == null) {
            if ( par == null ) {
                hidePopup();
            }
        }
    }
}
 
Example 11
Source Project: cakephp3-netbeans   File: PopupUtil.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void eventDispatched(java.awt.AWTEvent aWTEvent) {
    if (aWTEvent instanceof MouseEvent) {
        MouseEvent mv = (MouseEvent) aWTEvent;
        if (mv.getID() == MouseEvent.MOUSE_CLICKED && mv.getClickCount() > 0) {
            //#118828
            if (!(aWTEvent.getSource() instanceof Component)) {
                hidePopup();
                return;
            }

            Component comp = (Component) aWTEvent.getSource();
            Container par = SwingUtilities.getAncestorNamed(POPUP_NAME, comp); //NOI18N
            // Container barpar = SwingUtilities.getAncestorOfClass(PopupUtil.class, comp);
            // if (par == null && barpar == null) {
            if (par == null) {
                hidePopup();
            }
        }
    }
}