Multi-Panel multi-class GUI communication

Hello everyone! I'm building a (at this point) simple GUI that uses three JPanels. I'm trying to be modular and using different classes for each of the JPanels and the JFrame. I have a button in one JPanel that needs to update text in a label in another JPanel, but I can't figure out how.

I've done a lot of searching on Google and in my Murach's Java SE 6 book, but all the examples build the JPanels in the same class, thus they're able to just use variables for components in other classes directly.

Am I just going in the wrong direction with pulling the nested JPanels out to their own classes? It definitely seems to be easy if I just built all of my panels within the DatabasePanel class, but that doesn't feel very modular.

Below is what feels like the important bits of the code, in-line. I zipped up my Eclipse project (with a few data security-related snips) just in case someone wants to give it a more in-depth.

A mutator method for the output panel would work great. Sinc you're just displaying text in a JLabel, a public setText(String text) method would work fine, but If this JPanel held a JTextArea that displayed the the text and you wanted to keep the old text while displaying the new, then you would also probably give it a public void append(String text) method to allow outside classes to append to the JTextArea without having to directly interact with the JTextArea.

Then instead of having your GUI class implement an ActionListener, consider creating a Control class of some sort to handle key actions and to interact between classes. At some point we'll need to talk about avoiding having classes extend GUI components needlessly.

Thank you for your reply, Fubarable! I've actually spent the time between then and now thinking on the topic and repeatedly coming back to your reply code for thought. After bouncing around with a couple different thoughts which didn't pan out (as I tried to find something that gave the right amount of loose-coupling and required knowledge to fit the solution), I came to the below code (attached as well). Instead of using a controller class, it uses a Factory class (that I don't think is really a factory, now that I think of it) which is an attempt to abstract the knowledge into a central point and use it as a sort of object dictionary. Comments please? (Oh, I'm going to compress all classes/interface into a single code block, for brevity. And there's extra complexity because your poke that I didn't thread creation made me look into threading the query a little differently.) (Oh, and I went crazy with the keywords on that "Factory" class because I know that there are lots of people that say static classes are teh evil so I thought I'd go over the edge.)

As an aside: I would love to have that discussion of which you suggested on how I'm needlessly subclassing Swing components! I consider myself a professional incompetent, and am always trying to rectify this status.

Why not a mutator

You probably noticed that there's no mutator in my last post. The reason being that if I tried to call a setOutput() mutator method from the done() method of SwingWorker, a NullPointerException would be thrown.