- int msgCount = msgs.length;
- assertEquals(1 + msgCount, layout.getRows());
- assertEquals(msgCount, statusPanel.getComponentCount());
- int i = 0;
- for (Component c : statusPanel.getComponents())
+ try
+ {
+ SwingUtilities.invokeAndWait(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ int msgCount = msgs.length;
+ assertEquals(1 + msgCount, layout.getRows());
+ assertEquals(msgCount, statusPanel.getComponentCount());
+ int i = 0;
+ for (Component c : statusPanel.getComponents())
+ {
+ assertTrue(c instanceof JPanel);
+ assertTrue(((JPanel) c).getComponent(0) instanceof JLabel);
+ assertEquals(msgs[i++],
+ ((JLabel) ((JPanel) c).getComponent(0)).getText());
+ }
+ }
+ });
+ } catch (Exception e)