I am trying to refresh some components of my main JPanel (eg JLabels / JTextFields, contained in sub-JPanels) but I don't seem to be able to. The components data (eg JLabels text) are populated based on an instance variable object of my JFrame class, and I want to refresh those components when this object data change :
I've tried using :
jPanel.revalidate();
jPanel.repaint();
both on the main JPanel and on each component's sub-JPanel but this didn't seem to work.. Any suggestion on how this should be done ?
[EDIT] Below's the code from where I'm trying to refresh the JPanel. This is fired up by a pop-up JDialog, after filling some fields and pushing a "save" button triggering the below actionPerformed code
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
myObject.setOwner(jTextField1.getText());
myObject.setPurpose(jTextField2.getText());
myObject.setProject(jTextField3.getText());
myObject.setUntil(jTextField4.getText());
jDialog1.dispose();
jPanel1.revalidate();
jPanel1.repaint();
}