private void initUI() { JPanel infoPanel = new JPanel(); infoPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); infoPanel.setBackground(Color.WHITE); infoPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); infoPanel.add( new JLabel( new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("xmi.gif"))), FlowLayout.LEFT); JLabel textLabel = new JLabel(options[mode][0]); infoPanel.add(textLabel); ButtonGroup group = new ButtonGroup(); optionButton1 = new JRadioButton(options[mode][1]); optionButton2 = new JRadioButton(options[mode][2]); optionButton1.setSelected(true); group.add(optionButton1); group.add(optionButton2); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(0, 1)); buttonPanel.add(new JLabel("Semantic Connector will tag the XMI document with concepts.")); buttonPanel.add(optionButton1); buttonPanel.add(optionButton2); progressPanel = new ProgressPanel(goal); if (isProgress) { progressPanel.setVisible(true); optionButton1.setEnabled(false); optionButton2.setEnabled(false); } else { progressPanel.setVisible(false); } this.setLayout(new BorderLayout()); this.add(infoPanel, BorderLayout.NORTH); this.add(buttonPanel, BorderLayout.CENTER); this.add(progressPanel, BorderLayout.SOUTH); }
public int getSelection() { return optionButton2.isSelected() ? 2 : 1; }