Object can not be resolved.
Posted
by Gabriel A. Zorrilla
on Stack Overflow
See other posts from Stack Overflow
or by Gabriel A. Zorrilla
Published on 2010-03-09T02:56:00Z
Indexed on
2010/03/09
3:06 UTC
Read the original article
Hit count: 315
I have this code:
public class Window extends JFrame {
public Window(){
...
JButton button = new JButton("OK");
getContentPane().add(button);
ButtonHandler handler = new ButtonHandler();
button.addActionListener(handler);
...
}
private class ButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent event){
if (event.getSource() == button){ // <--- "button can not be resolved"
System.out.println("Hello");
}
}
}
I'm getting that error in Eclipse. I just made a (simplified) example found in a book, dont know what can be wrong. Knowledge eye required! :)
© Stack Overflow or respective owner