當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。