Object can not be resolved.
- by Gabriel A. Zorrilla
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! :)