我想從另一個JFrame更新JFrame。我有一個基本程序,它有兩個相同的組名,我想知道如何編寫程序,所以如果一個人改變了組名,它會自動改變另一個。如何從java中的另一個JFrame更新JFrame
在此先感謝
第一界面
Public String groupNam;
private void groupNActionPerformed(java.awt.event.ActionEvent evt) {
interface2 interface2 = new interface2();
groupNam = groupN.getText();
interface2.group.equals(groupNam); //interface2 is the class name of the other interface
}
第二界面
private void groupNameActionPerformed(java.awt.event.ActionEvent evt) {
groupName.getText().equals(groupNam); //calling the public string from interface 1 and placing it in groupName field
}
這是我嘗試但沒有奏效。
向我們展示一些描述您嘗試解決方案的相關代碼。 – Tdorno