The CardLayout class in Merlin has been rewritten and is now incompatiable with all previous versions of CardLayout. Instead of using a Hashtable to map the names of the components a Vector of private class Card is used. The CardLayout assumes that the Cards in this Vector are added in the same order as the components in the Container being layed out. This is an incorrect assumption because components can be inserted into a Container and do not always have to be added at the end of the list of components. The following example demonstrates this by inserting components into a Frame with CardLayout. The Components are added in reverse order. When you click on the card it will advance to the next card. On all previous versions of Java next advanced to the next card in the Frame's child list. In Merlin it now advvances to the next Card based on the order they were added. To reproduce, run this program under versions before Merlin and notice the ordering when you click on the Frame and then do the same under Merlin:
import java.awt.*;
import java.awt.event.*;
public class CardLayoutOrdering
{
public static void main (String args[])
{
Frame f = new Frame();
f.setLayout(new CardLayout());
for (int i = 1; i <= 10; i++)
{
f.add(new Card(i), String.valueOf(i), 0);
}
f.setSize(500,500);
f.setVisible(true);
}
}
class Card extends Component
{
public Card (int n)
{
index = n;
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
CardLayout l = (CardLayout)getParent().getLayout();
l.next(getParent());
}
});
}
public void paint(Graphics g)
{
g.drawString(String.valueOf(index), 100, 100);
}
private int index;
}

EVALUATION
We should investigate this issue for Mantis.
###@###.### 2002-05-28
Name: osR10079 Date: 09/04/2002
This is regression from fix for 4362381 (Once the remove button had press, next
item from the list should show.) In this fix i've tried to accumulate in
CardLayout all information for its functionality including order of cards.
Unfortunately, our usage of CardLayout doesn't provide this information when
user adds card by Container.add(Component, Object, int). Thus to fix this
problem we have to refix original bug (4362381).
###@###.### 2002-09-04
======================================================================