lastItemEvent = e;
}
public void test(TestHarness harness)
{
DefaultButtonModel m = new DefaultButtonModel();
m.addActionListener(this);
m.addChangeListener(this);
m.addItemListener(this);
m.setSelected(true);
harness.check(m.isSelected(), true);
harness.check(lastChangeEvent.getSource(), m);
harness.check(lastActionEvent, null);
harness.check(lastItemEvent.getSource(), m);
harness.check(lastItemEvent.getItem(), m);
// setting the same again causes no event
lastChangeEvent = null;
lastItemEvent = null;
m.setSelected(true);
harness.check(lastChangeEvent, null);
harness.check(lastItemEvent, null);
// are the states independent? Seems so.
m.setPressed(true);
harness.check(m.isSelected(), true);
m.setEnabled(false);
harness.check(m.isSelected(), true);
m.setEnabled(true);
harness.check(m.isSelected(), true);
}