lastVetoableEvent = event;
}
public void test(TestHarness harness)
{
JInternalFrame f = new JInternalFrame("F1");
harness.check(!f.isSelected());
// setSelected() only has an effect if the internal frame
// is showing.
JFrame fr = new JFrame();
fr.getContentPane().add(f);
f.setVisible(true);
fr.pack();
fr.setVisible(true);
f.addVetoableChangeListener(this);
f.addPropertyChangeListener(this);
f.addInternalFrameListener(this);
try
{
f.setSelected(true);
}
catch (PropertyVetoException e)
{
e.printStackTrace();
}
harness.check(f.isSelected());
// check the vetoable event
harness.check(lastVetoableEvent.getPropertyName(),
JInternalFrame.IS_SELECTED_PROPERTY);
harness.check(lastEvent.getSource(), f);
harness.check(lastEvent.getOldValue(), Boolean.FALSE);
harness.check(lastEvent.getNewValue(), Boolean.TRUE);
harness.check(lastEvent.getPropertyName(),
JInternalFrame.IS_SELECTED_PROPERTY);
harness.check(lastEvent.getSource(), f);
harness.check(lastEvent.getOldValue(), Boolean.FALSE);
harness.check(lastEvent.getNewValue(), Boolean.TRUE);
harness.check(events.size(), 1);
InternalFrameEvent event = (InternalFrameEvent) events.get(0);
harness.check(event.getSource(), f);
harness.check(event.getID(), InternalFrameEvent.INTERNAL_FRAME_ACTIVATED);
// set selected to true
events.clear();
try
{
f.setSelected(true);
}
catch (PropertyVetoException e)
{
// ignore
}
harness.check(f.isSelected());
harness.check(events.size(), 0);
}