天天看点

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

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

获取jframe上的所有控件:

代码:

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

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

 }