0102デフォルトの名無しさん
2012/03/05(月) 10:03:36.04JMenu menu;
menu.addActionListener(new ActionListener() {
actionPerformed(ActionEvent event) {
B b = new B(this);
}
});
}
ということ?(上はかなりてきとーだけど)
上の場合の this は A ではなくて、無名クラスのですよ。
下のようにすれば、望みどおりいくような気がします。
見当違いでないとよいのですが。
A() {
JMenu menu;
menu.addActionListener(new ActionListener() {
actionPerformed(ActionEvent event) {
createB();
}
});
}
private void createB() {
B b = new B(this);
}