aspose file tools
The moose likes Swing / AWT / SWT and the fly likes listener problems Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "listener problems" Watch "listener problems" New topic
Author

listener problems

aron beal
Greenhorn

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)+"");
addMouseListener(temp);
add(temp);
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
aron beal
Greenhorn

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.
AB
[ September 29, 2003: Message edited by: aron beal ]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: listener problems
 
Similar Threads
Is it possible to instantiate three classes into objects nestled in their own panels in one GUI?
Not able to receive mouse events on JPanel
Trying to show pics from array.
Tag displaying Objects nestled
How do I capture a mouseClicked event from a JTable within a JScrollPane