天天看點

java Swing:擷取JFrame下的所有控件

ava swing:擷取jframe上的所有控件

擷取jframe上的所有控件:

代碼:

 for(component co:ui.getrootpane().getcontentpane().getcomponents()) {

     systen.out.println(co.getclass().tostring());  //得到co的類型

 }