void initAnswerPanel(JPanel answerPanel) {
ButtonGroup group = new ButtonGroup();
int rows = type.isVertical() ? 0 : 1;
int cols = type.isVertical() ? 1 : 0;
Bag bag = new Bag();
if (!type.getLeftLabel().equals("")) {
JLabel label = new JLabel(type.getLeftLabel());
label.setHorizontalAlignment(JLabel.CENTER);
answerPanel.add(label, bag.WEST().inset(0, 0, 0, 12));
bag.inset(0);
}
JPanel itemPane = new JPanel(new GridLayout(rows, cols, 6, 6));
for (Choice choice : type.getChoices()) {
JRadioButton button = new JRadioButton(choice.getLabel());
button.setFont(SurveyPanel.FONT_QUESTION_ANSWER);
button.addItemListener(this);
button.putClientProperty("choice", choice);
group.add(button);
itemPane.add(button);
radioButtons.add(button);
}
answerPanel.add(itemPane, bag.nextX());
if (!type.getRightLabel().equals("")) {
JLabel label = new JLabel(type.getRightLabel());
label.setHorizontalAlignment(JLabel.CENTER);
answerPanel.add(label, bag.nextX().inset(0, 12, 0, 0));
bag.inset(0);
}
answerPanel.add(validationLabel, bag.nextX().inset(0, SPACE_BEFORE_VALIDATION, 0, 0));
updateRenderer();
}