I can't seem to find an answer to this through all the anonymous inner class questions on the site.
public void start()
{
/* Ask the user to login */
final LoginFrame login;
login = new LoginFrame(new ActionListener()
{
@Override
public void actionPerformed(final ActionEvent event)
{
switch (event.getActionCommand())
{
case "login":
/* @todo Login the user */
String username = login.getUsername();
String password = login.getPassword();
}
}
});
login.display();
}
My login frame takes in an ActionListener
. How do I access login
from within the new ActionListener()
?
Right now I'm getting an error:
Variable login may not have been initialized.