Jeff Monroe

Greenhorn
+ Follow
since Apr 25, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jeff Monroe

Michael, thanks for that thread link... Here are a couple of excellent articles regarding the topic of my question;

Maybe more simply put how do you register a listener on a component that lives in one object [class] and listen for it on another component that lives on a completely different object [class] where neither is necessarily aware of the other except for the "listener" relationship?



http://www.developer.com/java/ent/article.php/3685486
http://www.developer.com/design/article.php/10925_3678856_1

The way these articles were written makes this very easy to understand.
15 years ago
Okay... I'm being dumb. I appreciate your response and totally get the concept. But...

for reference - I'm trying to implement an application using the java AppFramework and I have a SingleFrameApplication with a FrameView that adds custom [each self-contained] component classes for menus, toolbars, content, and status bar to the frame. A custom JTabbedPane gets added to the main content area and custom JPanels get added as each tab. How does an action listener get added to the fields on the custom JPanel (like a text field) and then the listener get added to the file menu or tool bar item? Do I have to add and action listener to every field on the JPanel and listen for all of them on the menu item and/or tool bar button I want to disable based on any change? I'm thinking that a custom ActionListener is order here, but fundamentally not sure since the custom ActionListener would have to "know" about both the menu and toolbar.

Maybe more simply put how do you register a listener on a component that lives in one object [class] and listen for it on another component that lives on a completely different object [class] where neither is necessarily aware of the other except for the "listener" relationship?

As you can see by my question I'm a bit confused. Anyone have any simplistic approach to this for understanding sake?

Thanks kindly.
15 years ago
Hi this is kind of a generic implementation question...

If I have a panel that contains many text fields and any time one of these fields changes I'd like to [if appropriate] enable/disable a menu item or tool bar button based on the change what is the best practice in doing so? What is the easiest/best approach to listen for changes across a whole panel?

For Example: Let's say I have a "save" menu button I only want to enable if something is added or changed to the current visible panel and all components (i.e., menu bar, tool bar, main panel) are separately instantiated components added to the FrameView. How would a menu item listen for a change in the main panel?

Thanks for any advice.
15 years ago