- int buttonX = 1;
- int buttonY = getChildren().size() + 1;
- if (label.length() + 4 > getWidth()) {
- setWidth(label.length() + 7);
+ return new TRadioButton(this, 0, 0, label, 0);
+ }
+
+ /**
+ * Package private method for RadioButton to add itself to a RadioGroup
+ * container.
+ *
+ * @param button the button to add
+ */
+ void addRadioButton(final TRadioButton button) {
+ super.setHeight(getChildren().size() + 2);
+ button.setX(1);
+ button.setY(getChildren().size());
+ button.id = getChildren().size();
+ String label = button.getMnemonic().getRawLabel();
+
+ if (StringUtils.width(label) + 4 > getWidth()) {
+ super.setWidth(StringUtils.width(label) + 7);
+ }
+
+ if (getParent().getLayoutManager() != null) {
+ getParent().getLayoutManager().resetSize(this);