當前位置: 首頁>>代碼示例>>Java>>正文


Java ButtonGroup.getElements方法代碼示例

本文整理匯總了Java中javax.swing.ButtonGroup.getElements方法的典型用法代碼示例。如果您正苦於以下問題:Java ButtonGroup.getElements方法的具體用法?Java ButtonGroup.getElements怎麽用?Java ButtonGroup.getElements使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.ButtonGroup的用法示例。


在下文中一共展示了ButtonGroup.getElements方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDefaultComponent

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
public Component getDefaultComponent(Container aContainer) {
    Component c = getFirstComponent(aContainer);
    
    if (c instanceof AbstractButton) {
        ButtonModel bm = ((AbstractButton)c).getModel();
        if (bm instanceof DefaultButtonModel) {
            ButtonGroup bg = ((DefaultButtonModel)bm).getGroup();
            Enumeration<AbstractButton> en = bg == null ? null : bg.getElements();
            while (en != null && en.hasMoreElements()) {
                AbstractButton ab = en.nextElement();
                if (ab.isSelected()) return ab;
            }
        }
    }
    
    return c;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ProfilerPopup.java

示例2: getSelectedButtonText

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
String getSelectedButtonText(ButtonGroup buttonGroup) {
	    for (Enumeration buttons = buttonGroup.getElements(); buttons.hasMoreElements();) {
	        AbstractButton button = (AbstractButton) buttons.nextElement();

	        if (button.isSelected()) {
	            return button.getText();
	        }
	    }
	    return null;
}
 
開發者ID:srilekhadasari,項目名稱:online-quiz-application-in-java-with-jdbc-using-swing-login-registration-timer,代碼行數:11,代碼來源:Questions.java

示例3: createFilterPanel

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
private JComponent createFilterPanel(RecipientFilter... filters)
{
	ButtonGroup group = new ButtonGroup();
	for( RecipientFilter filter : filters )
	{
		switch( filter )
		{
			case USERS:
				users = createFilterButton(group, "searching.userGroupRole.filter.users");
				break;

			case GROUPS:
				groups = createFilterButton(group, "searching.userGroupRole.filter.groups");
				break;

			case ROLES:
				roles = createFilterButton(group, "searching.userGroupRole.filter.roles");
				break;

			default:
				break;
		}
	}

	if( filters.length == 1 )
	{
		// We don't need to show this panel
		return null;
	}
	else
	{
		// Add each of the buttons to the panel
		JPanel all = new JPanel(new FlowLayout(FlowLayout.LEFT));
		for( Enumeration<AbstractButton> e = group.getElements(); e.hasMoreElements(); )
		{
			all.add(e.nextElement());
		}
		return all;
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:41,代碼來源:SearchFinder.java

示例4: watch

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
public void watch(ButtonGroup g)
{
	Enumeration<AbstractButton> e = g.getElements();
	while( e.hasMoreElements() )
	{
		watch(e.nextElement());
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:9,代碼來源:ChangeDetector.java

示例5: ignore

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
public void ignore(ButtonGroup g)
{
	Enumeration<AbstractButton> e = g.getElements();
	while( e.hasMoreElements() )
	{
		ignore(e.nextElement());
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:9,代碼來源:ChangeDetector.java

示例6: getSelectedButtonText

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
/**
 * Determines the label of the current selected button.
 * @param buttonGroup
 * @return The text label of the selected button.
 */
public static String getSelectedButtonText(ButtonGroup buttonGroup) {
    for (Enumeration<AbstractButton> buttons = buttonGroup.getElements(); buttons.hasMoreElements();) {
        AbstractButton button = buttons.nextElement();

        if (button.isSelected()) {
            return button.getText();
        }
    }

    return null;
}
 
開發者ID:LEB-EPFL,項目名稱:SASS,代碼行數:17,代碼來源:ButtonGroupUtils.java

示例7: selectButtonModelFromText

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
/**
 * Selects the button in a button group based on its text label.
 * @param buttonGroup
 * @param text The text label of the desired button to select.
 */
public static void selectButtonModelFromText(ButtonGroup buttonGroup, String text) {
    for (Enumeration<AbstractButton> buttons = buttonGroup.getElements(); buttons.hasMoreElements();) {
        AbstractButton button = buttons.nextElement();
        

        if (button.getText().equals(text)) {
            button.setSelected(true);
        }
    }

}
 
開發者ID:LEB-EPFL,項目名稱:SASS,代碼行數:17,代碼來源:ButtonGroupUtils.java

示例8: setButtonGroup

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
private void setButtonGroup(String rdValue, ButtonGroup buttongroup) {
    Enumeration enumeration = buttongroup.getElements();
    while (enumeration.hasMoreElements()) {
        AbstractButton button = (AbstractButton) enumeration.nextElement();
        if (button.getActionCommand().equals(rdValue)) {
            buttongroup.setSelected(button.getModel(), true);
            break;
        }
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:11,代碼來源:DriverSettings.java

示例9: setButtonModelFromText

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
private void setButtonModelFromText(String text, ButtonGroup Bgroup) {
    for (Enumeration<AbstractButton> buttons = Bgroup.getElements(); buttons.hasMoreElements();) {
        AbstractButton button = buttons.nextElement();
        if (button.getText().equals(text)) {
            button.setSelected(true);
        }
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:9,代碼來源:CognizantITSSettings.java

示例10: getSelectedButton

import javax.swing.ButtonGroup; //導入方法依賴的package包/類
private String getSelectedButton(ButtonGroup bGroup) {
    for (Enumeration<AbstractButton> buttons = bGroup.getElements(); buttons.hasMoreElements();) {
        AbstractButton button = buttons.nextElement();
        if (button.isSelected()) {
            return button.getText();
        }
    }
    return "None";
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:10,代碼來源:CognizantITSSettings.java


注:本文中的javax.swing.ButtonGroup.getElements方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。