本文整理汇总了Java中javax.swing.JRadioButton类的典型用法代码示例。如果您正苦于以下问题:Java JRadioButton类的具体用法?Java JRadioButton怎么用?Java JRadioButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRadioButton类属于javax.swing包,在下文中一共展示了JRadioButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CheckboxDelegate
import javax.swing.JRadioButton; //导入依赖的package包/类
CheckboxDelegate() {
super();
cb = new JCheckBox() {
@Override
public boolean hasFocus() {
return getTarget().hasFocus();
}
};
rb = new JRadioButton() {
@Override
public boolean hasFocus() {
return getTarget().hasFocus();
}
};
setLayout(null);
setRadioButton(false);
add(rb);
add(cb);
}
示例2: getType
import javax.swing.JRadioButton; //导入依赖的package包/类
ResetType getType () {
String cmd = null;
for (JRadioButton btn : new JRadioButton[] { panel.rbHard, panel.rbMixed, panel.rbSoft }) {
if (btn.isSelected()) {
cmd = btn.getActionCommand();
break;
}
}
return ResetType.valueOf(cmd);
}
示例3: MoreCommitsRevertType
import javax.swing.JRadioButton; //导入依赖的package包/类
MoreCommitsRevertType (RepositoryFile repositoryFile, JRadioButton button) {
super(button);
startPath =
new RepositoryPaths(
repositoryFile,
null,
null,
getPanel().startRevisionTextField,
getPanel().startSearchButton
);
startPath.addPropertyChangeListener(RevertModifications.this);
startPath.setupBehavior(null, 0, null, SvnSearch.SEACRH_HELP_ID_REVERT);
endPath =
new RepositoryPaths(
repositoryFile,
null,
null,
getPanel().endRevisionTextField,
getPanel().endSearchButton
);
endPath.addPropertyChangeListener(RevertModifications.this);
endPath.setupBehavior(null, 0, null, SvnSearch.SEACRH_HELP_ID_REVERT);
}
示例4: SectorPanel
import javax.swing.JRadioButton; //导入依赖的package包/类
public SectorPanel()
{
super(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.restrictwarning"), false); //$NON-NLS-1$
restrict = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.restrictedu"), true); //$NON-NLS-1$
selectable = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.contributor")); //$NON-NLS-1$
ButtonGroup group = new ButtonGroup();
group.add(restrict);
group.add(selectable);
final int height = restrict.getPreferredSize().height;
final int[] rows = {height, height};
final int[] cols = {TableLayout.FILL};
setInnerLayout(new TableLayout(rows, cols, 5, 5));
addInner(restrict, new Rectangle(0, 0, 1, 1));
addInner(selectable, new Rectangle(0, 1, 1, 1));
setSelected(false);
}
示例5: listAvailableProviders
import javax.swing.JRadioButton; //导入依赖的package包/类
static JRadioButton[] listAvailableProviders(String path) {
List<JRadioButton> res = new ArrayList<JRadioButton>();
for (Action a : Utilities.actionsForPath(path+"/Actions")) { // NOI18N
if (a == null) {
continue;
}
Object msg = a.getValue("wizardMessage"); // NOI18N
if (msg instanceof String) {
JRadioButton button = new JRadioButton((String)msg);
button.putClientProperty("action", a); // NOI18N
res.add(button);
}
}
return res.toArray(new JRadioButton[0]);
}
示例6: getReplacemetPanel
import javax.swing.JRadioButton; //导入依赖的package包/类
private Component getReplacemetPanel() {
JPanel group = new JPanel(new GridLayout(0, 1));
group.setBorder(BorderFactory.createTitledBorder(ResourceLoader
.getString("ArrowReplacementType.name")));
group.add(safe = new JRadioButton("ArrowReplacementType.safe"));
group.add(children = new JRadioButton("ArrowReplacementType.branching"));
group.add(all = new JRadioButton("ArrowReplacementType.everywhere"));
safe.setSelected(true);
ButtonGroup g = new ButtonGroup();
g.add(children);
g.add(all);
g.add(safe);
setReplaceEnable(false);
return group;
}
示例7: setSectionMode
import javax.swing.JRadioButton; //导入依赖的package包/类
private void setSectionMode(Mode mode) {
this.selection = mode;
JRadioButton select;
switch (selection) {
case refactorToExistingEmbeddedSection:
//select first existing css section if available
if(existingEmbeddedSectionsComboBox.getModel().getSize() > 1) { //first item is the 'create new section'
existingEmbeddedSectionsComboBox.setSelectedIndex(1); //select second item, which is the first existing section
}
case refactorToNewEmbeddedSection:
select = embeddedSectionRB;
break;
case refactorToExistingExternalSheet:
case refactorToReferedExternalSheet:
case refactorToNewExternalSheet:
select = externalSheetRB;
break;
default:
throw new IllegalStateException();
}
select.setSelected(true);
}
示例8: addChoice
import javax.swing.JRadioButton; //导入依赖的package包/类
public void addChoice(final String key, String displayText)
{
final JRadioButton rb = new JRadioButton(displayText);
if( doubleClickToSelect )
{
rb.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
if( e.getClickCount() >= 2 )
{
addClicked(key);
}
}
});
}
choices.addButton(rb, key);
// Add after the instructions label and any existing choices
add(rb, choices.size());
}
示例9: finish
import javax.swing.JRadioButton; //导入依赖的package包/类
@Override
protected void finish() {
try {
if (localButton.isSelected()) {
localRepositoryPanel.makeRepository();
} else {
// check all custom repository radio buttons
for (Pair<RepositoryConfigurationPanel, JRadioButton> value : repoConfigPanels.values()) {
// once we have found the selected radio button
if (value.getSecond().isSelected()) {
// lookup the corresponding factory and create the repository
value.getFirst().makeRepository();
}
}
}
super.finish();
} catch (RepositoryException e) {
SwingTools.showSimpleErrorMessage("cannot_create_repository", e);
}
}
示例10: CredentialsPanel
import javax.swing.JRadioButton; //导入依赖的package包/类
private CredentialsPanel(String username, String url) {
this.url = url;
this.usernamePassword = new JRadioButton("Username and password");
this.usernamePassword.addActionListener(new RadioButtonListener());
this.anonymous = new JRadioButton("Anonymous access");
this.anonymous.addActionListener(new RadioButtonListener());
this.buttonGroup = new ButtonGroup();
this.buttonGroup.add(usernamePassword);
this.buttonGroup.add(anonymous);
this.usernameLabel = new JLabel("Username:");
this.username = new JTextField(Objects.toString(username, ""), 20);
this.passwordLabel = new JLabel("Password:");
this.password = new JPasswordField(20);
if (username == null || username.isEmpty()) {
this.anonymous.setSelected(true);
} else {
this.usernamePassword.setSelected(true);
this.password.addAncestorListener(new RequestFocusListener());
}
radioButtonToggled();
layoutComponents();
}
示例11: create2ColPane
import javax.swing.JRadioButton; //导入依赖的package包/类
/**
* Like createPane, but creates a pane with 2 columns of radio buttons. The
* number of buttons passed in *must* be even.
*/
private JPanel create2ColPane(String description, JRadioButton[] radioButtons, JButton showButton) {
JLabel label = new JLabel(description);
int numPerColumn = radioButtons.length / 2;
JPanel grid = new JPanel(new GridLayout(0, 2));
for (int i = 0; i < numPerColumn; i++) {
grid.add(radioButtons[i]);
grid.add(radioButtons[i + numPerColumn]);
}
JPanel box = new JPanel();
box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
box.add(label);
grid.setAlignmentX(0.0f);
box.add(grid);
JPanel pane = new JPanel(new BorderLayout());
pane.add(box, BorderLayout.PAGE_START);
pane.add(showButton, BorderLayout.PAGE_END);
return pane;
}
示例12: AnonActionProfileListener
import javax.swing.JRadioButton; //导入依赖的package包/类
public AnonActionProfileListener(JComboBox<Object> anonProfiles, JLabel profileLabel, JRadioButton radioBodyCharac1,
JRadioButton radioBodyCharac2, JRadioButton radioDates1, JRadioButton radioDates2, JRadioButton radioBd2,
JRadioButton radioBd1, JRadioButton radioPt1, JRadioButton radioPt2,
JRadioButton radioSc1, JRadioButton radioSc2, JRadioButton radioDesc1, JRadioButton radioDesc2){
this.profileLabel = profileLabel;
this.anonProfiles = anonProfiles;
this.radioBodyCharac1 = radioBodyCharac1;
this.radioBodyCharac2 = radioBodyCharac2;
this.radioDates1 = radioDates1;
this.radioDates2 = radioDates2;
this.radioBd2 = radioBd2;
this.radioBd1 = radioBd1;
this.radioPt1 = radioPt1;
this.radioPt2 = radioPt2;
this.radioSc1 = radioSc1;
this.radioSc2 = radioSc2;
this.radioDesc1 = radioDesc1;
this.radioDesc2 = radioDesc2;
}
示例13: createTutorialButton
import javax.swing.JRadioButton; //导入依赖的package包/类
private JRadioButton createTutorialButton(final WizardController controller, final Map settings) {
JRadioButton b = new JRadioButton(Resources.getString("WizardSupport.LoadTutorial")); //$NON-NLS-1$
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
controller.setProblem(Resources.getString("WizardSupport.LoadingTutorial")); //$NON-NLS-1$
try {
new TutorialLoader(controller, settings, new BufferedInputStream(tutorial.getTutorialContents()), POST_INITIAL_STEPS_WIZARD, tutorial).start();
}
catch (IOException e1) {
logger.error("", e1);
controller.setProblem(Resources.getString("WizardSupport.ErrorLoadingTutorial")); //$NON-NLS-1$
}
}
});
return b;
}
示例14: createLoadSavedGameButton
import javax.swing.JRadioButton; //导入依赖的package包/类
private JRadioButton createLoadSavedGameButton(final WizardController controller, final Map settings) {
JRadioButton b = new JRadioButton(Resources.getString("WizardSupport.LoadSavedGame")); //$NON-NLS-1$
b.addActionListener(new ActionListener() {
@SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent e) {
settings.put(WizardSupport.ACTION_KEY, LOAD_GAME_ACTION);
Wizard wiz = new BranchingWizard(new LoadSavedGamePanels(), POST_LOAD_GAME_WIZARD).createWizard();
settings.put(POST_INITIAL_STEPS_WIZARD, wiz);
controller.setForwardNavigationMode(WizardController.MODE_CAN_CONTINUE);
controller.setProblem(null);
}
});
return b;
}
示例15: setBoolean
import javax.swing.JRadioButton; //导入依赖的package包/类
/** Set the current value in the entry with the given name.
* If the entry is not a checkbox, then throw an exception.
* Notify listeners that the value has changed.
* @exception NoSuchElementException If there is no item with the
* specified name. Note that this is a runtime exception, so it
* need not be declared explicitly.
* @exception IllegalArgumentException If the entry is not a
* checkbox. This is a runtime exception, so it
* need not be declared explicitly.
*/
public void setBoolean(String name, boolean value)
throws NoSuchElementException, IllegalArgumentException {
Object result = _entries.get(name);
if (result == null) {
throw new NoSuchElementException(
"No item named \"" + name + "\" in the query box.");
}
if (result instanceof JRadioButton) {
((JRadioButton) result).setSelected(value);
} else {
throw new IllegalArgumentException(
"Item named \""
+ name
+ "\" is not a radio button, and hence does not have "
+ "a boolean value.");
}
_notifyListeners(name);
}