Java Code Examples for javax.swing.JComponent.getComponentCount()

The following are Jave code examples for showing how to use getComponentCount() of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: DropTargetLayer.java   View Source Code Vote up 5 votes
private  void drawOpenSpotAtEndOfMenuBar(Graphics2D g2, JComponent mb) {
    Point mblocation = SwingUtilities.convertPoint(mb, new Point(0,0), this);
    if(mb.getComponentCount() > 0) {
        Component lastComp = mb.getComponent(mb.getComponentCount()-1);
        mblocation.x += lastComp.getX() + lastComp.getWidth();
    }
    g2.drawRect(mblocation.x+2, mblocation.y+2, mb.getHeight()-4, mb.getHeight()-4);
}
 
Example 2
Project: ramus   File: QualifierPreferencesPanel.java   View Source Code Vote up 5 votes
private void clearPopupMenu(JComponent component) {
    component.setComponentPopupMenu(null);
    for (int i = 0; i < component.getComponentCount(); i++) {
        Component c = component.getComponent(i);
        if (c instanceof JComponent)
            clearPopupMenu((JComponent) c);
    }
}
 
Example 3
Project: ramus   File: ModelPropertiesDialog.java   View Source Code Vote up 5 votes
private void clearPopupMenu(JComponent component) {
    component.setComponentPopupMenu(null);
    for (int i = 0; i < component.getComponentCount(); i++) {
        Component c = component.getComponent(i);
        if (c instanceof JComponent)
            clearPopupMenu((JComponent) c);
    }
}
 
Example 4
Project: incubator-netbeans   File: DropTargetLayer.java   View Source Code Vote up 4 votes
private boolean isLastChild(JComponent child, JComponent parent) {
    if(parent == null) return false;
    if(parent.getComponentCount() < 1) return false;
    return (child == parent.getComponent(parent.getComponentCount()-1));
}