我想加载所有控件变量和示例 Button1的 BUTTON2 BUTTON3
然后编辑他们的属性,如
Button1.settext() ;
请告诉我他们是这样做的方法。
答案 0 :(得分:0)
假设您在同一帧中拥有所有这些标签,您可以尝试以下方法:
Arrays.asList(myframe.getComponents()).forEach((c) -> {
if( c instanceof JLabel) {
JLabel l = (JLabel)c;
//do whatever you'd like to do with your label here...
}
});