本文整理汇总了Java中javax.swing.JRadioButton.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java JRadioButton.setEnabled方法的具体用法?Java JRadioButton.setEnabled怎么用?Java JRadioButton.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JRadioButton
的用法示例。
在下文中一共展示了JRadioButton.setEnabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NewRepositoryDialog
import javax.swing.JRadioButton; //导入方法依赖的package包/类
private NewRepositoryDialog() {
super(RapidMinerGUI.getMainFrame(), "repositorydialog", true, new Object[] {});
Box firstPage = new Box(BoxLayout.Y_AXIS);
ButtonGroup checkBoxGroup = new ButtonGroup();
localButton = new JRadioButton(new ResourceActionAdapter("new_local_repositiory"));
localButton.setSelected(true);
checkBoxGroup.add(localButton);
firstPage.add(localButton);
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()) {
String key = factory.getI18NKey();
RepositoryConfigurationPanel repositoryConfigurationPanel = factory.getRepositoryConfigurationPanel();
JRadioButton radioButton = new JRadioButton(new ResourceActionAdapter(key));
radioButton.setEnabled(factory.enableRepositoryConfiguration());
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);
}
示例2: save
import javax.swing.JRadioButton; //导入方法依赖的package包/类
void save(){
JPanel savePanel = new JPanel( new BorderLayout() );
savePanel.setBorder(BorderFactory.createEmptyBorder( 0, 5, 0, 5));
JPanel savePrompt = new JPanel(new GridLayout(0, 1));
JRadioButton saveTableRB = new JRadioButton("Save as ASCII Table");
JRadioButton saveJPGProfileRB = new JRadioButton("Save Profile as JPG");
JRadioButton savePNGProfileRB = new JRadioButton("Save Profile as PNG");
saveJPGProfileRB.setEnabled(tabs[2].isSelected());
savePNGProfileRB.setEnabled(tabs[2].isSelected());
ButtonGroup saveGroup = new ButtonGroup();
saveGroup.add(saveTableRB);
saveGroup.add(saveJPGProfileRB);
saveGroup.add(savePNGProfileRB);
saveTableRB.setSelected(true);
savePrompt.add(saveTableRB);
savePrompt.add(saveJPGProfileRB);
savePrompt.add(savePNGProfileRB);
savePanel.add(savePrompt, BorderLayout.CENTER);
int s = JOptionPane.showConfirmDialog(map, savePanel, "Save Options", JOptionPane.OK_CANCEL_OPTION);
if(s == 2) {
return;
}
if (saveTableRB.isSelected()) {
saveTable();
return;
}
String fmt = "jpg";
if (savePNGProfileRB.isSelected()) {
fmt = "png";
}
saveProfile(fmt);
}
示例3: BaseDialog
import javax.swing.JRadioButton; //导入方法依赖的package包/类
/**
* Set up and show the dialog. The first Component argument determines which
* frame the dialog depends on; it should be a component in the dialog's
* controlling frame. The second Component argument should be null if you
* want the dialog to come up with its left corner in the center of the
* screen; otherwise, it should be the component on top of which the dialog
* should appear.
*/
public BaseDialog(Component frameComp, Component locationComp,
String title, I_TickerManager tickerManager) {
super(JOptionPane.getFrameForComponent(frameComp), title, true);
this.frameComp = frameComp;
dateChooser = new JDateChooser(Calendar.getInstance().getTime());
dateChooser.setLocale(new Locale("fi", "FI"));
this.tickerManager = tickerManager;
// Create and initialize the buttons.
cancelButton = new JButton(BUTTON_CANCEL);
cancelButton.addActionListener(this);
cancelButton.setActionCommand(BUTTON_CANCEL);
okButton = new JButton(BUTTON_OK);
okButton.setActionCommand(BUTTON_OK);
okButton.addActionListener(this);
getRootPane().setDefaultButton(okButton);
okButton.setEnabled(false);
rateField = new JTextField(FIELD_LEN);
rateField.setVisible(true);
rateField.setText("1.0000");
rateFieldLabel = new JLabel("Valuuttakurssi: ");
rateFieldLabel.setLabelFor(rateField);
rateFieldLabel.setVisible(true);
localCurrencyButton = new JRadioButton(localCurrencyString);
foreignCurrencyButton = new JRadioButton(foreignCurrencyString);
currencyGroup = new ButtonGroup();
localCurrencyButton.setActionCommand(localCurrencyString);
foreignCurrencyButton.setActionCommand(foreignCurrencyString);
localCurrencyButton.setSelected(true);
currencyGroup.add(localCurrencyButton);
currencyGroup.add(foreignCurrencyButton);
updateRateFieldCcy("EUR", false);
localCurrencyButton.addActionListener(this);
foreignCurrencyButton.addActionListener(this);
foreignCurrencyButton.setEnabled(false);
}
示例4: radioEnable
import javax.swing.JRadioButton; //导入方法依赖的package包/类
protected void radioEnable(String name, boolean enable)
{
JRadioButton rb = radios.get(name);
if (rb == null) return;
rb.setEnabled(enable);
}