Q:

Making GUI update information from double array?

I have a cardfield that is a double array and a GUI for it, with a JButton/JTextArea for each cardfield. I'm having trouble making the GUI update with card information when the double array does. 
I have tried repaint() and revalidate() but those didn't work. I'm pretty sure that's because it just updates the GUI itself, but I want it to be connected to the double array. I always tried using a thread, and I'm pretty sure that's the answer, I'm just having trouble implementing it. 
How would I make a thread run continuously in the background that takes information from each element in the double array and sends it to the appropriate JTextArea/JButton? Basically when a player uses placeCard, I want the GUI to update the information as well, not only the double array field. I have researched threads a bit before asking this, but in the documentation the examples used makes a whole class that is ran by a thread, but I would just want to have one method ran in the background for updating this. 

A:

Be careful when dealing with concurrency in Swing. Swing is not thread safe. There is a golden rule when dealing with Swing, that is, you are expected to only update UI components from within the context of the Event Dispatching Thread.
Take a look at Concurrency in Swing and attention to the section on Worker Threads and SwingWorker

