In the following code use the quickfix "Create method" on the call to "windowClosed()" and have Idea generate the method in the outer class.
(I always directly delegate to a "real" method from within anonymous listeners).
public class Test {
private JFrame frame;
private void foo() {
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
windowClosed();
}
});
}
}
Result is:
public class Test {
private JFrame frame;
private void foo() {
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
windowClosed();
}
});
}
private void windowClosed() {
}
}
Instead Idea should have changed the call to "Test.this.windowClosed();"
Description
In the following code use the quickfix "Create method" on the call to "windowClosed()" and have Idea generate the method in the outer class.
(I always directly delegate to a "real" method from within anonymous listeners).
public class Test {
private JFrame frame;
private void foo() {
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
windowClosed();
}
});
}
}
Result is:
public class Test {
private JFrame frame;
private void foo() {
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
windowClosed();
}
});
}
private void windowClosed() {
}
}
Instead Idea should have changed the call to "Test.this.windowClosed();"