Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Java Swing pass events to child of another Parent

Posted on 2007-12-01
3
Medium Priority
?
1,671 Views
Last Modified: 2013-11-23
Hi,
I am not sure if this has been brought up before, unless I happened to miss it when browsing. Problem is: I have a JFrame (the main frame), which has 2 JPanels a and b. Within JPanel a, I have several more JPanel's (BufferedImage holders) which has individual attached mouseEvents. When any of these mouseEvents are triggered, this information has to be passed to the JFrame (the mouseEvent handler's parent's parent), which will then trigger an animation sequence in JPanel b.
I've tried various means, including static variables, etc. but I can't seem to trigger the JFrame to init the other JPanel.
Any help would be appreciated.

Thanks
0
Comment
Question by:zhtet
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 800 total points
ID: 20387791
You just need to add the JFrame as a mouse event listener for the panels' mouse events
0
 

Author Comment

by:zhtet
ID: 20387923
DOH!! guess i really need to hit the sack soon :) ...
Many Thanks for the quick response. Solution accepted.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20388033
:-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question