I am creating a MDI Application by Java. I design a JInternalFrame
public class account extends javax.swing.JInternalFrame
{account GUI here}
that show data get from SQL. On this account, I create a JButton named btnReName
private javax.swing.JButton btnReName;
to open a new JDialog ReName.
public class ReName extends javax.swing.JDialog
This JDialog ReName is created to change the name in SQL. After rename successfull, I click on a JButton named btnConfirm
private javax.swing.JButton btnConfirm;
to close this JDialog. After click button Confirm, a JOption appear
like that. I want after click OK, the JDialog ReName is closed, and at the same time, the data on the JInternalFrame account update exactly to what i changed in this JDialog ReName by re-query data from SQL(in other words, i want to update the account by clicking on a Button btnConfirm created on ReName that opened by this JInternalFrame account)
but i dont know how to design it.
Can someone guide me how to create the Button with the function like i was description?
Link to my full-code
The below code does what you want. I did not find a minimal, reproducible example in your question so I guessed that you are using a JTable to display the Player Information. I also only added the Rename button since your question only concerns that button. Here is the code.
When I run the above code, the GUI initially looks as follows (using JDK 11 on Windows 10)
This is a screen capture after selecting the name to change and pressing button Rename.
This is a screen capture after entering the new name and pressing button Confirm.
And finally, a screen capture after pressing button OK. Notice that the first column of the selected row in the
JTablehas changed to what was entered in theJDialog.