This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes listener problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "listener problems" Watch "listener problems" New topic

listener problems

aron beal

Joined: Sep 29, 2003
Posts: 2
Hello the forum,
I'm in the midst of writing a simple Animator, and I'm having listener problems. The following is a method that adds a "Frame" to the end of an "Animation". The class that this is in extends JPanel, and the Frame class for the moment extends JButton Implements MouseListener.
public void addFrame(Image i){
if(i != null){
Frame temp = new Frame(i,(length()+1)+"");
System.out.println("width: "+temp.getImageWidth()+", height: "+temp.getImageHeight()+", "+length()+" frames total");
if (playhead_position < 0) {
playhead_position = 0;
Mouse events are not being heard by my "Frames". Now, these Frame(JButton) objects are nestled in the Animator(Jpanel) which is nestled within a JScrollPane which is inside of a JFrame. My question is, does the external JFrame or JScrollPane need to know that the Animator has objects that are listening for mouse events, or is it enough for the Animator itself to know?
Thanks in advance,
aron beal

Joined: Sep 29, 2003
Posts: 2
Never mind, I figured it out. The answer was "yes indeedy, it is enough for just the Animator to know". I attached an anonymous mouselistener to the Frame object, and it registered nicely.
[ September 29, 2003: Message edited by: aron beal ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: listener problems
jQuery in Action, 3rd edition