- // Top panel with two radio buttons to select source type
- JPanel radioPanel = new JPanel();
- ButtonGroup radioGroup = new ButtonGroup();
- radioPanel.setLayout(new GridLayout(1, 0));
- _typeRadios = new JRadioButton[2];
- _typeRadios[0] = new JRadioButton("Openstreetmap");
- radioGroup.add(_typeRadios[0]);
- radioPanel.add(_typeRadios[0]);
- _typeRadios[1] = new JRadioButton("Cloudmade");
- radioGroup.add(_typeRadios[1]);
- radioPanel.add(_typeRadios[1]);
- _typeRadios[0].setSelected(true);
- // listener for clicks on type radios
- ActionListener typeListener = new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- CardLayout cl = (CardLayout) _cards.getLayout();
- if (_typeRadios[0].isSelected()) {cl.first(_cards);}
- else {cl.last(_cards);}
- enableOK();
- }
- };
- _typeRadios[0].addActionListener(typeListener);
- _typeRadios[1].addActionListener(typeListener);
- radioPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- dialogPanel.add(radioPanel, BorderLayout.NORTH);