Java Code Examples for javax.swing.JRadioButton#setText()
The following examples show how to use
javax.swing.JRadioButton#setText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColorPanel.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 2
Source File: DefaultsDisplay.java From beautyeye with Apache License 2.0 | 6 votes |
public ValueRenderer(Color colors[]) { super(colors); buttonIconRenderer = new JButton(); buttonIconRenderer.setBorderPainted(false); buttonIconRenderer.setContentAreaFilled(false); buttonIconRenderer.setText("(for AbstractButtons only)"); radioIconRenderer = new JRadioButton(); radioIconRenderer.setBorderPainted(false); radioIconRenderer.setText("for JRadioButtons only)"); checkboxIconRenderer = new JCheckBox(); checkboxIconRenderer.setBorderPainted(false); checkboxIconRenderer.setText("for JCheckBoxes only)"); menuItemIconRenderer = new JMenuItem(); menuItemIconRenderer.setBorderPainted(false); menuItemIconRenderer.setText("(for JMenuItems only)"); }
Example 3
Source File: DefaultsDisplay.java From littleluck with Apache License 2.0 | 6 votes |
public ValueRenderer(Color colors[]) { super(colors); buttonIconRenderer = new JButton(); buttonIconRenderer.setBorderPainted(false); buttonIconRenderer.setContentAreaFilled(false); buttonIconRenderer.setText("(for AbstractButtons only)"); radioIconRenderer = new JRadioButton(); radioIconRenderer.setBorderPainted(false); radioIconRenderer.setText("for JRadioButtons only)"); checkboxIconRenderer = new JCheckBox(); checkboxIconRenderer.setBorderPainted(false); checkboxIconRenderer.setText("for JCheckBoxes only)"); menuItemIconRenderer = new JMenuItem(); menuItemIconRenderer.setBorderPainted(false); menuItemIconRenderer.setText("(for JMenuItems only)"); }
Example 4
Source File: ColorPanel.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 5
Source File: ColorPanel.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 6
Source File: ColorPanel.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 7
Source File: ColorPanel.java From hottub with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 8
Source File: ColorPanel.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 9
Source File: ColorPanel.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 10
Source File: ColorPanel.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 11
Source File: ColorPanel.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 12
Source File: ColorPanel.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 13
Source File: ColorPanel.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
void buildPanel() { int count = this.model.getCount(); this.spinners[4].setVisible(count > 4); for (int i = 0; i < count; i++) { String text = this.model.getLabel(this, i); Object object = this.spinners[i].getLabel(); if (object instanceof JRadioButton) { JRadioButton button = (JRadioButton) object; button.setText(text); button.getAccessibleContext().setAccessibleDescription(text); } else if (object instanceof JLabel) { JLabel label = (JLabel) object; label.setText(text); } this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i)); this.spinners[i].setValue(this.values[i]); this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text); DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor(); editor.getTextField().getAccessibleContext().setAccessibleName(text); this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text); this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text); editor.getTextField().getAccessibleContext().setAccessibleDescription(text); } }
Example 14
Source File: UI.java From netbeans with Apache License 2.0 | 5 votes |
public static JRadioButton createRadioButton(String text, String toolTip) { JRadioButton button = new JRadioButton(); Mnemonics.setLocalizedText(button, text); button.setText(cutMnemonicAndAmpersand(text)); button.setToolTipText(toolTip); return button; }
Example 15
Source File: HttpFuzzerMessageProcessorTagUIPanel.java From zap-extensions with Apache License 2.0 | 5 votes |
private void addRadioButton(JRadioButton radio, String name, boolean selected) { radio.setText(name); radio.setSelected(selected); fieldsPanel.add(radio); fieldsPanel.add(new Panel()); radioGroup.add(radio); }
Example 16
Source File: ImagePopUpMenuPlugin.java From netbeans-mmd-plugin with Apache License 2.0 | 5 votes |
@Nonnull private JPanel makeSelectPanel(@Nonnull @MustNotContainNull final String[] options, @Nonnull final AtomicInteger selected) { final JPanel panel = new JPanel(new GridBagLayout()); final GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0; constraint.fill = GridBagConstraints.HORIZONTAL; constraint.anchor = GridBagConstraints.WEST; final ButtonGroup group = UI_COMPO_FACTORY.makeButtonGroup(); int selectedIndex = lastSelectedImportIndex; for (int i = 0; i < options.length; i++) { final JRadioButton button = UI_COMPO_FACTORY.makeRadioButton(); button.setText(options[i]); if (selectedIndex == i) { button.setSelected(true); selected.set(i); } group.add(button); final int currentIndex = i; button.addActionListener(new ActionListener() { @Override public void actionPerformed(@Nonnull final ActionEvent e) { if (button.isSelected()) { selected.set(currentIndex); } } }); panel.add(button, constraint); } return panel; }
Example 17
Source File: KwikiPDFToolBar.java From ET_Redux with Apache License 2.0 | 4 votes |
private void SetupDateChooserButtons() { dateChooserButtonGroup = new ButtonGroup(); date206_238_radioButton = new JRadioButton("206/238"); dateChooserButtonGroup.add(date206_238_radioButton); date206_238_radioButton.setFont(new java.awt.Font("Arial", 1, 10)); date206_238_radioButton.setText("206/238"); date206_238_radioButton.setName("age206_238r"); date206_238_radioButton.setBounds(40, 1, 70, 17); date206_238_radioButton.setSelected(true); date206_238_radioButton.setOpaque(true); date206_238_radioButton.setBackground(Color.white); add(date206_238_radioButton); date207_206_radioButton = new JRadioButton("207/206"); dateChooserButtonGroup.add(date207_206_radioButton); date207_206_radioButton.setFont(new java.awt.Font("Arial", 1, 10)); date207_206_radioButton.setText("207/206"); date207_206_radioButton.setName("age207_206r"); date207_206_radioButton.setBounds(40, 19, 70, 17); date207_206_radioButton.setOpaque(true); date207_206_radioButton.setBackground(Color.white); add(date207_206_radioButton); dateBest_radioButton = new JRadioButton("best"); dateChooserButtonGroup.add(dateBest_radioButton); dateBest_radioButton.setFont(new java.awt.Font("Arial", 1, 10)); dateBest_radioButton.setText("best"); dateBest_radioButton.setName("bestAge"); dateBest_radioButton.setOpaque(true); dateBest_radioButton.setBackground(Color.white); dateBest_radioButton.setBounds(40, 37, 70, 17); add(dateBest_radioButton); // choose date for (Enumeration e = dateChooserButtonGroup.getElements(); e.hasMoreElements();) { final JRadioButton jrb = (JRadioButton) e.nextElement(); jrb.addActionListener((ActionEvent arg0) -> { // oct 2014 handle new Pbc corrections String chosenDateName = jrb.getName(); ((DateProbabilityDensityPanel) probabilityPanel).setChosenDateName(chosenDateName); ((DateProbabilityDensityPanel) probabilityPanel).// setSelectedFractions(sample.getUpbFractionsUnknown()); ((DateProbabilityDensityPanel) probabilityPanel).prepareAndPaintPanel(); }); } }
Example 18
Source File: SwingRadioButtonListWidget.java From atdl4j with MIT License | 4 votes |
@Override protected List< ? extends Component> createBrickComponents() { List<Component> components = new ArrayList<Component>(); JPanel wrapper = new JPanel(); String tooltip = getTooltip(); // label if ( control.getLabel() != null ) { label = new JLabel(); label.setName(getName()+"/label"); label.setText( control.getLabel() ); if ( tooltip != null ) label.setToolTipText( tooltip ); components.add(label); } /* //TODO: implement horiz/vert orientation for Swing if ( ((RadioButtonListT) control).getOrientation() != null && PanelOrientationT.VERTICAL.equals( ((RadioButtonListT) control).getOrientation() ) ) { c.setLayout( new GridLayout( 1, false ) ); } else { RowLayout rl = new RowLayout(); rl.wrap = false; c.setLayout( rl ); } */ // radioButton for ( ListItemT listItem : ( (RadioButtonListT) control ).getListItem() ) { JRadioButton radioElement = new JRadioButton(); radioElement.setName(getName()+"/button/"+listItem.getEnumID()); radioElement.setText( listItem.getUiRep() ); if ( parameter != null ) { for ( EnumPairT enumPair : parameter.getEnumPair() ) { if ( enumPair.getEnumID() == listItem.getEnumID() ) { radioElement.setToolTipText( enumPair.getDescription() ); break; } } } else { radioElement.setToolTipText( tooltip ); } group.add( radioElement ); buttons.add( radioElement ); wrapper.add( radioElement ); } // set initValue (Note that this has to be the enumID, not the // wireValue) // set initValue if ( ControlHelper.getInitValue( control, getAtdl4jOptions() ) != null ) setValue( (String) ControlHelper.getInitValue( control, getAtdl4jOptions() ), true ); components.add(wrapper); return components; }
Example 19
Source File: BlazeSelectOptionControl.java From intellij with Apache License 2.0 | 4 votes |
BlazeSelectOptionControl(BlazeNewProjectBuilder builder, Collection<T> options) { this.userSettings = builder.getUserSettings(); JPanel canvas = new JPanel(new VerticalLayout(4)); canvas.setPreferredSize(ProjectViewUi.getContainerSize()); titleLabel = new JLabel(getTitle()); canvas.add(titleLabel); canvas.add(new JSeparator()); JPanel content = new JPanel(new VerticalLayout(12)); content.setBorder(Borders.empty(20, 20, 0, 0)); JScrollPane scrollPane = new JBScrollPane(content); scrollPane.setBorder(BorderFactory.createEmptyBorder()); canvas.add(scrollPane); ButtonGroup buttonGroup = new ButtonGroup(); Collection<OptionUiEntry<T>> optionUiEntryList = Lists.newArrayList(); for (T option : options) { JPanel vertical = new JPanel(new VerticalLayout(10)); JRadioButton radioButton = new JRadioButton(); radioButton.setText(option.getDescription()); vertical.add(radioButton); JComponent optionComponent = option.getUiComponent(); if (optionComponent != null) { JPanel horizontal = new JPanel(new HorizontalLayout(0)); horizontal.setBorder(Borders.emptyLeft(25)); horizontal.add(optionComponent); vertical.add(horizontal); option.optionDeselected(); radioButton.addItemListener( itemEvent -> { if (radioButton.isSelected()) { option.optionSelected(); } else { option.optionDeselected(); } }); } content.add(vertical); buttonGroup.add(radioButton); optionUiEntryList.add(new OptionUiEntry<>(option, radioButton)); } OptionUiEntry selected = null; String previouslyChosenOption = userSettings.get(getOptionKey(), null); if (previouslyChosenOption != null) { for (OptionUiEntry<T> entry : optionUiEntryList) { if (entry.option.getOptionName().equals(previouslyChosenOption)) { selected = entry; break; } } } if (selected == null) { selected = Iterables.getFirst(optionUiEntryList, null); } if (selected != null) { selected.radioButton.setSelected(true); } this.canvas = canvas; this.optionUiEntryList = optionUiEntryList; }
Example 20
Source File: CommanderWindow.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void createMissionPanel() { WebPanel panel = new WebPanel(new BorderLayout()); tabPane.add(MISSION_TAB, panel); policyMainPanel = new WebPanel(new BorderLayout()); panel.add(policyMainPanel, BorderLayout.NORTH); policyMainPanel.setPreferredSize(new Dimension(200, 125)); policyMainPanel.setMaximumSize(new Dimension(200, 125)); // Create a button panel WebPanel buttonPanel = new WebPanel(new GridLayout(4,1)); // buttonPanel.setPreferredSize(new Dimension(250, 120)); policyMainPanel.add(buttonPanel, BorderLayout.CENTER); buttonPanel.setBorder(BorderFactory.createTitledBorder("Trade With Other Settlements")); buttonPanel.setToolTipText("Select the trade policy with other settlements"); ButtonGroup group0 = new ButtonGroup(); ButtonGroup group1 = new ButtonGroup(); r0 = new JRadioButton("Can initiate Trading Mission", true); r1 = new JRadioButton("Cannot initiate Trading Mission"); // Set up initial conditions if (settlement.isMissionDisable(Trade.DEFAULT_DESCRIPTION)) { r0.setSelected(false); r1.setSelected(true); } else { r0.setSelected(true); r1.setSelected(false); } r2 = new JRadioButton("No Trading Missions from all settlements"); r3 = new JRadioButton(ALLOW); // Set up initial conditions boolean noTrading = true; if (settlement.isTradeMissionAllowedFromASettlement(settlement)) { List<Settlement> list = getOtherSettlements(); // List<Settlement> allowedSettlements = settlementMissionList.getCheckedValues(); for (Settlement s: list) { if (!settlement.isTradeMissionAllowedFromASettlement(s)) { noTrading = false; break; } } } WebLabel selectLabel = new WebLabel(" Choose :"); selectLabel.setMinimumSize(new Dimension(150, 25)); selectLabel.setPreferredSize(150, 25); innerPanel = new WebPanel(new BorderLayout()); innerPanel.add(selectLabel, BorderLayout.NORTH); // Set settlement check boxes settlementMissionList = new WebCheckBoxList<>(StyleId.checkboxlist, createModel(getOtherSettlements())); settlementMissionList.setVisibleRowCount(3); innerPanel.add(settlementMissionList, BorderLayout.CENTER); WebScrollPane = new WebScrollPane(innerPanel); WebScrollPane.setMaximumWidth(250); // mainPanel.add(WebScrollPane, BorderLayout.EAST); if (noTrading) { r2.setSelected(true); r3.setSelected(false); policyMainPanel.remove(WebScrollPane); policyMainPanel.add(emptyPanel, BorderLayout.EAST); // settlementMissionList.setEnabled(false); } else { r2.setSelected(false); r3.setSelected(true); r3.setText(ALLOW + SEE_RIGHT); policyMainPanel.remove(emptyPanel); policyMainPanel.add(WebScrollPane, BorderLayout.EAST); // settlementMissionList.setEnabled(true); } group0.add(r0); group0.add(r1); group1.add(r2); group1.add(r3); buttonPanel.add(r0); buttonPanel.add(r1); buttonPanel.add(r2); buttonPanel.add(r3); PolicyRadioActionListener actionListener = new PolicyRadioActionListener(); r0.addActionListener(actionListener); r1.addActionListener(actionListener); r2.addActionListener(actionListener); r3.addActionListener(actionListener); }