I've forgotten to say, that I use my JRadioButtons in a view, where the user can select between three options. Here is a snipped:
Code:
public class BookingView extends AbstractView{
private JRadioButton rdbIdSearch = new JRadioButton();
private JRadioButton rdbMultiSearch = new JRadioButton();
private JRadioButton rdbDateSearch = new JRadioButton();
...
These buttons are then added to a button group, to ensure that only one button can be active. As I don't use binding for this radio buttons I can use the TableLayoutBuilder:
Code:
TableLayoutBuilder b = new TableLayoutBuilder();
b.cell(rdbIdSearch);
b.cell(rdbMultiSearch);
b.cell(rdbDateSearch);
//some more work
b.getPanel(); //Returns a JPanel with the buttons
With component I mean, that I receive a predefined radio button with a configured design, like:
Code:
rdbDateSearch = myFactory.createRadioButton();
Until now I've not used JRadioButtons for binding properties, because I prefer ComboBox instead of radio buttons. If you will offer your user a choice of different values a combo box is a good choice.
But it will be an interesting feature to create a generic option group for a given collection.
hope this helps a little bit
markus