...  northPanel.add(comboBox); 53
 54    // create array for radio buttons
 55    radio = new JRadioButton[looks.length];
 56
 57    JPanel southPanel = new JPanel();
 58
 59    // use a GridLayout with 3 buttons in each row
 60    int rows = (int) Math.ceil(radio.length / 3.0);
 61    southPanel.setLayout(new GridLayout(rows, 3));
 62
 63    group = new ButtonGroup(); // button group for look-and-feels
 64    ItemHandler handler = new ItemHandler(); // look-and-feel handler
 65
 66    for (int count = 0; count < radio.length; count++)
 67    {
 68     radio[count] = new JRadioButton(lookNames[count]);
 69     radio[count].addItemListener(handler); // add handler
 70     group.add(radio[count]); // add radio button to group
 71     southPanel.add(radio[count]); // add radio button to panel
 72    }
 73
 74 add(northPanel, ...

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.