Mega Code Archive

 
Categories / Java / Swing JFC
 

Retrieve all components individually

import java.awt.Component; import javax.swing.JFrame; public class Main {   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);     }   } }