当前位置: 首页>>代码示例>>Java>>正文


Java JRadioButton类代码示例

本文整理汇总了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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:LWCheckboxPeer.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:Reset.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:RevertModifications.java

示例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);
}
 
开发者ID:equella,项目名称:Equella,代码行数:24,代码来源:DRMRightsTab.java

示例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]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:AddServerInstanceWizard.java

示例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;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:19,代码来源:SectorNameEditor.java

示例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);


}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ExtractInlinedStylePanel.java

示例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());
}
 
开发者ID:equella,项目名称:Equella,代码行数:24,代码来源:AbstractChoiceDialog.java

示例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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:NewRepositoryDialog.java

示例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();
}
 
开发者ID:pascalgn,项目名称:jiracli,代码行数:23,代码来源:CredentialsPanel.java

示例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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:27,代码来源:DialogDemo.java

示例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;
}
 
开发者ID:anousv,项目名称:OrthancAnonymization,代码行数:20,代码来源:AnonActionProfileListener.java

示例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;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:17,代码来源:WizardSupport.java

示例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;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:15,代码来源:WizardSupport.java

示例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);
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:29,代码来源:Query.java


注:本文中的javax.swing.JRadioButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。