Ok, I have a JToolBar with JButtons on a JFrame with a JDesktopPane. We'll pretend that is all one class. Now, in another class I have a JInternalFrame which I add to the JDestopPane via one of the Buttons on the JToolbar. After I open this InternalFrame I need to disable the Button. That part is easy. But when I close the JInternalFrame, how do I notify the Button to enable itself? Right now my JButton is static and I dot reference the JButton object from my JInternalFrame. Is this the only way? Or is there a better way? I would prefer a non-static approach. Thanks.
Hi Gregg, You should be able to do it with a java.beans.PropertyChangeListener. You can send a pseudo-property named "buttonState" or whatever and have either the button or its Frame listen for changes in that property. I posted a rather lengthy example here: ComponentMediater
You certainly don't have to go to that much trouble for one component though. I used this to keep several components in a consistent state and it worked very well and is incredibly easy to use once you get the Mediator running. Hope this helps, Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher