aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes regarding addactionListener method?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "regarding addactionListener method??" Watch "regarding addactionListener method??" New topic
Author

regarding addactionListener method??

aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
hello
import java.awt.*;
import java.awt.event.*;
class Shar extends Frame implements ActionListener
{
public Shar(){
Panel p=new Panel();
Button b=new Button();
p.add();
b.addActionListener(this);

//more code here

}
public void actionPerformed(ActionEvent ae)
{
System.out.println(" Hi ");
}
public static void main(Stirng s[])
{
Shar s=new Shar();
}
}



My Doubt is How the control flow calls the actionPerformed() method after b.addActionListener(this); ???


Thanks in Adv
Mikko Kohtamäki
Ranch Hand

Joined: Dec 13, 2008
Posts: 112
It's called when you press the button, button's UI haves event handler which implements MuoseListener and more which fires this actionPerformed.

And next time use code tags, it's just mouse click away.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

Miiko means Use Code Tags.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regarding addactionListener method??