下面列出了javax.swing.JRadioButton#setEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private JComponent createColorPanel()
{
m_colorBox = Box.createVerticalBox();
ButtonGroup group = new ButtonGroup();
m_black = new JRadioButton(i18n("LB_BLACK"));
m_black.setToolTipText(i18n("TT_ANALYZE_BLACK"));
m_black.setEnabled(false);
group.add(m_black);
m_colorBox.add(m_black);
m_white = new JRadioButton(i18n("LB_WHITE"));
m_white.setToolTipText(i18n("TT_ANALYZE_WHITE"));
m_white.setEnabled(false);
group.add(m_white);
m_colorBox.add(m_white);
return m_colorBox;
}
private JPanel getTopLeftPanel() {
JPanel ret = new JPanel();
JLabel tips = new JLabel("文件编码:");
ret.add(tips);
JRadioButton utf8 = new JRadioButton("UTF-8");
ret.add(utf8);
JRadioButton gbk = new JRadioButton("GBK");
ret.add(gbk);
ButtonGroup bg = new ButtonGroup();
bg.add(utf8);
bg.add(gbk);
utf8.setSelected(true);
gbk.setEnabled(false);
return ret;
}
private JPanel getTopRightPanel() {
JPanel ret = new JPanel();
JRadioButton uncode = new JRadioButton("不加密");
ret.add(uncode);
JRadioButton encode = new JRadioButton("加密");
ret.add(encode);
ButtonGroup bg = new ButtonGroup();
bg.add(uncode);
bg.add(encode);
uncode.setSelected(true);
encode.setEnabled(false);
return ret;
}
private NewRepositoryDialog() {
super(RapidMinerGUI.getMainFrame(), "repositorydialog", true, new Object[]{});
Box firstPage = new Box(BoxLayout.Y_AXIS);
ButtonGroup checkBoxGroup = new ButtonGroup();
Map<String, Component> cards = new HashMap<String, Component>();
cards.put("first", firstPage);
cards.put("local", localRepositoryPanel);
// register a radio button for each custom repository type
for (CustomRepositoryFactory factory : CustomRepositoryRegistry.INSTANCE.getFactories()) {
// some repos may not want to appear here
if (!factory.showRepositoryConfigurationInNewRepositoryDialog()) {
continue;
}
String key = factory.getI18NKey();
RepositoryConfigurationPanel repositoryConfigurationPanel = factory.getRepositoryConfigurationPanel();
JRadioButton radioButton = new JRadioButton(new ResourceActionAdapter(key));
radioButton.setEnabled(factory.enableRepositoryConfiguration());
radioButton.setSelected(repoConfigPanels.isEmpty());
repoConfigPanels.put(key, new Pair<>(repositoryConfigurationPanel, radioButton));
checkBoxGroup.add(radioButton);
firstPage.add(radioButton);
cards.put(factory.getI18NKey(), repositoryConfigurationPanel.getComponent());
}
firstPage.add(Box.createVerticalGlue());
layoutDefault(cards);
}
private JRadioButton addRadioButton(String name, JPanel panel) {
JRadioButton radioButton = new JRadioButton(name);
radioButton.setEnabled(true);
radioButton.addActionListener(this);
panel.add(radioButton);
return radioButton;
}
private JRadioButton addRadioButton(String name) {
JRadioButton radioButton = new JRadioButton(name);
radioButton.setEnabled(true);
radioButton.addActionListener(this);
add(radioButton);
return radioButton;
}
private JRadioButton addRadioButton(String name, JPanel panel) {
JRadioButton radioButton = new JRadioButton(name);
radioButton.setEnabled(true);
radioButton.addActionListener(this);
panel.add(radioButton);
return radioButton;
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
final Boolean enabled = (Boolean) evt.getNewValue();
for (CrsForm crsForm : crsForms) {
final JRadioButton button = crsForm.getRadioButton();
button.setEnabled(enabled);
final boolean selected = button.isSelected();
crsForm.getCrsUI().setEnabled(selected && enabled);
}
}
private JPanel createSimulationTypeOptions()
{
JLabel choose2 = new JLabel("Analysis Type:");
ODE = new JRadioButton("ODE");
monteCarlo = new JRadioButton("Monte Carlo");
markov = new JRadioButton("Markov");
fba = new JRadioButton("FBA");
sbml = new JRadioButton("Model");
dot = new JRadioButton("Network");
xhtml = new JRadioButton("Browser");
ODE.addActionListener(this);
monteCarlo.addActionListener(this);
markov.addActionListener(this);
fba.addActionListener(this);
sbml.addActionListener(this);
dot.addActionListener(this);
xhtml.addActionListener(this);
ButtonGroup simulationTypeButtons = new ButtonGroup();
simulationTypeButtons.add(ODE);
simulationTypeButtons.add(monteCarlo);
simulationTypeButtons.add(markov);
simulationTypeButtons.add(fba);
simulationTypeButtons.add(sbml);
simulationTypeButtons.add(dot);
simulationTypeButtons.add(xhtml);
if (!Executables.reb2sacFound)
{
dot.setEnabled(false);
xhtml.setEnabled(false);
}
ODE.setSelected(true);
JPanel simulationTypeOptions = new JPanel();
simulationTypeOptions.add(choose2);
simulationTypeOptions.add(ODE);
simulationTypeOptions.add(monteCarlo);
simulationTypeOptions.add(markov);
simulationTypeOptions.add(fba);
simulationTypeOptions.add(sbml);
simulationTypeOptions.add(dot);
simulationTypeOptions.add(xhtml);
return simulationTypeOptions;
}