return preferredHeight;
}
public Dimensions getPreferredSize() {
Dimensions preferredSize;
CardPane cardPane = (CardPane)getComponent();
if (sizeToSelection) {
if (selectionChangeTransition == null) {
Component selectedCard = cardPane.getSelectedCard();
if (selectedCard == null) {
preferredSize = new Dimensions(0, 0);
} else {
preferredSize = selectedCard.getPreferredSize();
}
} else {
float percentComplete = selectionChangeTransition.getPercentComplete();
int previousWidth;
int previousHeight;
if (selectionChangeTransition.fromCard == null) {
previousWidth = 0;
previousHeight = 0;
} else {
Dimensions fromSize = selectionChangeTransition.fromCard.getPreferredSize();
previousWidth = fromSize.width;
previousHeight = fromSize.height;
}
int width;
int height;
if (selectionChangeTransition.toCard == null) {
width = 0;
height = 0;
} else {
Dimensions toSize = selectionChangeTransition.toCard.getPreferredSize();
width = toSize.width;
height = toSize.height;
}
int preferredWidth = previousWidth + (int)((float)(width - previousWidth) * percentComplete);
int preferredHeight = previousHeight + (int)((float)(height - previousHeight) * percentComplete);
preferredSize = new Dimensions(preferredWidth, preferredHeight);
}
} else {
int preferredWidth = 0;
int preferredHeight = 0;
for (Component card : cardPane) {
Dimensions cardSize = card.getPreferredSize();
preferredWidth = Math.max(cardSize.width, preferredWidth);
preferredHeight = Math.max(cardSize.height, preferredHeight);
}
preferredSize = new Dimensions(preferredWidth, preferredHeight);
}
return preferredSize;
}