aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes What does (this) and ActionEvent e mean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "What does (this) and ActionEvent e mean? " Watch "What does (this) and ActionEvent e mean? " New topic
Author

What does (this) and ActionEvent e mean?

numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
public class lopotop extends JFrame implements ActionListener {

button.addActionListener(this);

public void actionPerformed(ActionEvent e) {

//something happens

}

}

I have come across this a number of times and have simply memorised how it is written but I have very little (if any) understanding of what is actually going on, something I find hugely frustrating. What do we mean when we pass (this) to the parameters? Again when we pass (ActionEvent e) what do we mean?
And now i basically want to make my own actionlistner to understand the working (don't want to use java built in classes or libraries) some one please guide me how i can do that how many classes should i make , what method use in them?

I have tried reading on this matter and have heard talk of overriding methods and other seemingly mind boggling terms but I have not fully grasped this. I am not content simply writing things I do not understand.

I would appreciate a link to a helpful resource that could help me in this regard or, better yet, if someone who understands this spares a moment to explain this as though they were speaking to a rather dull 15year old

Many thanks in advance for your help.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> What do we mean when we pass (this) to the parameters?

read the apidocs.

button.addActionListener(this);

from the apidocs what is the argument required?
how is it provided?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

Have you gone through the tutorial about Passing Information to a Method or a Constructor?


luck, db
There are no new questions, but there may be new answers.
numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
i have read the apidoc.......
may you please tell me how i can make my own actionlistner please please guide me ?
what classes should i make and what methods wrote in them ?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
start by searching this forum for
addActionListener

read/study the sample code you find
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What does (this) and ActionEvent e mean?