I'm coding an interface Java swing and I'm facing a problem of refresh of an element, here's the relevant code:
A button swing associated with a method:
Code:
validateButton.addActionListener(new java.awt.event.ActionListener () {
public void actionPerformed(java.awt.event.ActionEvent evt) {
validateButtonPA ();
}
});
This is the method:
Code:
private void validateButtonPA (){
SwingUtilities.invokeLater(new Runnable () {
public void run() {
informationArea.setText("Search the Naming Service is in progress." );
}
});
..................(rest of processing code) ..........................
}
The problem is that with or without invokeLater the setText takes effect only after the processing code that follows. I'm trying to add repaint, revalidate, .... nothing works.
I do not understand what's wrong, I tried to follow an online tutorial related to threads but it does not seem to work as described.
If someone sees what's wrong, I thank you for the report
Bookmarks