Reputation: 43077
I have a doubt related to this variable that contains an inner class:
private final Action actionLogOut = new AbstractAction() {
{
putValue(Action.NAME, _("log-out"));
}
@Override
public void actionPerformed(ActionEvent e)
{
System.out.println("logOutButton clicked !!!");
System.exit(0);
}
};
My problem is that I can't understand what exactly do this line of code:
putValue(Action.NAME, _("log-out"));
Some one can help me?
Upvotes: 2
Views: 87
Reputation: 5758
putValue() is a method with the 2 parameters and first parameter seems to be some sort of a constant, defined in either outer
or inner
class(I am assuming this since it is all Capital letters) and the second parameter
_("log-out")
is a function call to a function named ... something like this :
_(String arg1) // having _ as a function name is terribly a bad practice btw.
hence _("log-out")
in the line putValue(Action.NAME, _("log-out"));
will be substituted with the value that is returned from the function named _(String arg1)
Upvotes: 5
Reputation: 3543
I guess that underscore brings your attention.
As _
is a valid character to use in the method name, your
_("log-out")
is probably invocation of some _(String s)
method, declared somewhere else.
Oh, and don't write methods named that way...
Upvotes: 4