Search code examples
javaswingcheckboxitemlistener

Package for ItemListener class


I am learning java swing from the Dive Log tutorial. An object has been declared as the following:

ItemListener handler = new CheckBoxHandler();

The above produces a compilation error saying ItemListener class is missing. The imports that have been made are as follow:

import java.awt.*;
import javax.swing.*;

Please tell me which import can solve the issue. p.s. I think this bit of information is perhaps irrelevant, but still, I am using NetBeans IDE.

Thanks in advance.


Solution

  • The package is java.awt.event.

    import java.awt.event.ItemListener;