What is the difference between ActionListener and ItemListener?
Just write the most important thing to answer that question in a small paragraph and shows examples in code.
1
Expert's answer
2016-11-22T12:56:11-0500
// we use anonymous ActionListener to doSomething() when someone click button JButton b = new JButton(); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doSomething(); } }); // we use ItemListener to doSomething() when this checkbox selected or deselected Checkbox cb = new Checkbox(); cb.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { doSomething(); } });
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment