Apart from the fact that action commands are probably very bad design?
You have a group; those are used for
radio buttons (
Java™ Tutorials Section). You put several radio buttons in a group; when you click one button all the others become unselected. So
you should be able to work out what group.getSelection() means.
Then buttons have a getActionCommand method which returns the text used for their action command. A smallButton might use "small" and the largeButton would then use "large" as action commands.