我创建了由 jDesktoppane 组成的 java Swing 应用程序,在其中我从主框架 (JFrame) 中的切换按钮加载/调用一些 jinternal 框架。而且我对所有切换按钮都使用了 jButton 组,因此按下按钮时只有一帧。
由于我使用了切换按钮,因此即使我处理了 JInternalFrame,相关的切换按钮也将处于按下模式(已选择)。我尝试了很多方法,但无法将切换按钮的状态从选中更改为未选中。
首先,我在 Main JFrame 中创建了一个方法。
public void buttongroup_off(){
buttonGroup 1.setSelected(null,false);
}
然后我在 JInternalFrame 的退出按钮内创建了一个对象,并通过它调用了 buttongroup_off() 方法。
private void jButton 7 ActionPerformed(java.awt.event.ActionEvent evt) {
Main m1= new Main();
m1.buttongroup_off();
this.dispose();
}
但它不起作用!!,有人可以帮我吗?我对编程很陌生。