Example usage for javax.swing JFrame getComponentCount

List of usage examples for javax.swing JFrame getComponentCount

Introduction

In this page you can find the example usage for javax.swing JFrame getComponentCount.

Prototype

public int getComponentCount() 

Source Link

Document

Gets the number of components in this panel.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JFrame container = new JFrame();
    // Get number of children
    int count = container.getComponentCount();

    for (int i = 0; i < count; i++) {
        Component c = container.getComponent(i);
    }/*  w  w  w. j  a  v  a 2s  .c om*/
}

From source file:op.tools.SYSTools.java

/**
 * luft rekursiv durch alle Kinder eines JFrames und entfernt evtl. vorhandene Listener.
 *//*  w ww .j  av  a 2  s.c  o  m*/
public static void unregisterListeners(JFrame container) {
    if (container == null) {
        return;
    }
    if (container.getComponentCount() > 0) {
        Component[] c = container.getComponents();
        for (int i = 0; i < c.length; i++) {
            if (c[i] instanceof JComponent) {
                unregisterListeners((JComponent) c[i]);
            }
        }
    }
}