CardPane cardPane = (CardPane)getComponent();
if (selectionChangeTransition == null) {
if (matchSelectedCardSize) {
Component selectedCard = cardPane.getSelectedCard();
if (selectedCard == null) {
preferredSize = new Dimensions(0, 0);
} else {
preferredSize = selectedCard.getPreferredSize();
}
} else {
preferredSize = new Dimensions(0, 0);
Orientation orientation = cardPane.getOrientation();
int selectedIndex = cardPane.getSelectedIndex();
for (Component card : cardPane) {
Dimensions cardSize = card.getPreferredSize();
if (selectedIndex != -1
|| orientation == Orientation.HORIZONTAL) {
preferredSize.width = Math.max(cardSize.width, preferredSize.width);
}
if (selectedIndex != -1
|| orientation == Orientation.VERTICAL) {
preferredSize.height = Math.max(cardSize.height, preferredSize.height);
}
}
}
} else {
float percentComplete = selectionChangeTransition.getPercentComplete();
int previousWidth;
int previousHeight;
Component previousSelectedCard = selectionChangeTransition.getPreviousSelectedCard();
if (previousSelectedCard == null) {
previousWidth = 0;
previousHeight = 0;
} else {
previousWidth = previousSelectedCard.getWidth();
previousHeight = previousSelectedCard.getHeight();
}
int width;
int height;
Component selectedCard = selectionChangeTransition.getSelectedCard();
if (selectedCard == null) {
width = 0;
height = 0;
} else {
width = selectedCard.getWidth();
height = selectedCard.getHeight();
}
int preferredWidth = 0;
int preferredHeight = 0;