• Post Reply Bookmark Topic Watch Topic
  • New Topic

Explicit and Implicit referencing

 
Zach Donovan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

public class EventButton extends Button
{
public EventButton()
{
this.addActionListener(new ActionListener()
{
public actionPerformed(ActionEvent e)
EventButton.this.outerClassMethod();
});
}
public void outerClassMethod(){}
}
The above code uses explicit outer class referencing.
My question is how do i call a method in the EventButton class using
implicit referencing?

Thanks in advance.
cheers
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't qualify it, just invoke the method as if it were a method in the same class.
 
Campbell Ritchie
Marshal
Posts: 52519
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is one reason for qualifying it: idleness.

If you use some IDEs, you can put in OuterClass. and you get a dropdown lits with "this" in. So you click on "this" and push "." and you get a dropdown list of members.

That is why I frequently use the explicit referencing.

[edit]And you don't get any spelling errors like "lits" for "list." [/edit]
[ June 21, 2006: Message edited by: Campbell Ritchie ]
 
Paper has not yet been outlawed – so let your Java Swing application print with wild abandon: JPDF
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!