This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Action Listeners Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Action Listeners" Watch "Action Listeners" New topic

Action Listeners

Jacob Coddaire
Ranch Hand

Joined: Jan 11, 2011
Posts: 36

I have a GUI in one class that makes a custom JDialog box come up. However, that JDialog box is in another class. Can I make two action listeners (1 per class) and have them both work?

For example, it would be something like

in the first class. It would call the action listener of the second class, the JDialog.

If not, then how would I solve this issue?
Greg Brannon

Joined: Oct 24, 2010
Posts: 557
Show us what you've tried so far and describe what's not working.

Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36579
But if it's a GUI, we usually discuss them elsewhere, so I shall move this discussion.
I agree. Here's the link:
subject: Action Listeners
Similar Threads
ContainerListener not firing from a JPanel contained within a JDialog
Having difficulty sizing a viewport to fit inside a JDialog...any suggestions?
pop up menu
setAction and addActionListener
Reference to the outer class