java - Running a "this" Method inside actionPerformed - JButton? -
i have jbutton added actionperformed, , tried write "this" method , won't allow it. how can this? example of want do:
public void methodname(string results) { this.results = results; } button.addactionlistener(new actionlistener() { public void actionperformed(actionevent event) { this.methodname(asdf); }
because it's anonymous class, using this
refer anonymous class instance, not overall class. around this, denote want reference outer class specifically:
something = new something() { public void overridden() { yourclass.this.methodname("test"); } };
Comments
Post a Comment