本文整理汇总了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;
}
示例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;
}
}
示例4: watch
import javax.swing.ButtonGroup; //导入方法依赖的package包/类
public void watch(ButtonGroup g)
{
Enumeration<AbstractButton> e = g.getElements();
while( e.hasMoreElements() )
{
watch(e.nextElement());
}
}
示例5: ignore
import javax.swing.ButtonGroup; //导入方法依赖的package包/类
public void ignore(ButtonGroup g)
{
Enumeration<AbstractButton> e = g.getElements();
while( e.hasMoreElements() )
{
ignore(e.nextElement());
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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