javax.swing.JRadioButton#isSelected ( )源码实例Demo

下面列出了javax.swing.JRadioButton#isSelected ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: osp   文件: VideoIO.java
/**
  * Gets the selected video engine type.
  * 
  * @return the video engine type
  */  
public VideoType getSelectedVideoType() {
	if (chooser.getAccessory()==null
			|| chooser.getAccessory()==emptyPanel)
		return null;
   for (JRadioButton button: buttonMap.keySet()) {
   	if (button.isSelected()) {
   		VideoType engineType = buttonMap.get(button);
   		OSPLog.finest("selected video type: "+engineType); //$NON-NLS-1$
   		String engineName = engineType.getClass().getSimpleName();
   		String ext = XML.getExtension(selectedFile.getName());
   		VideoType specificType = getVideoType(engineName, ext);
   		return specificType==null? engineType: specificType;
   	}
   }
   return null;
}
 
/**
 *
 */
public void refreshView() {
    Enumeration buttons = includedFractions_buttonGroup.getElements();
    while (buttons.hasMoreElements()) {
        JRadioButton b = (JRadioButton) buttons.nextElement();
        if (b.isSelected()) {
            b.doClick();
            break;
        }
    }

    if (((TripoliSessionRawDataView) tripoliSessionRawDataView).isSAVED_YAXIS_IS_UNIFORM()) {
        uniformYaxis.doClick();
    } else {
        independentYaxis.doClick();
    }

    if (((TripoliSessionRawDataView) tripoliSessionRawDataView).getSAVED_DATA_USED_FOR_SCALING().equals(IncludedTypeEnum.ALL)) {
        allDataUsedForScaling.doClick();
    } else {
        includedDataUsedForScaling.doClick();
    }

}
 
/**
 *
 */
public void refreshView() {
    Enumeration buttons = includedFractions_buttonGroup.getElements();
    while (buttons.hasMoreElements()) {
        JRadioButton b = (JRadioButton) buttons.nextElement();
        if (b.isSelected()) {
            b.doClick();
            break;
        }
    }

    if (((TripoliSessionRawDataView) tripoliSessionRawDataView).isSAVED_YAXIS_IS_UNIFORM()) {
        uniformYaxis.doClick();
    } else {
        independentYaxis.doClick();
    }

    if (((TripoliSessionRawDataView) tripoliSessionRawDataView).getSAVED_DATA_USED_FOR_SCALING().equals(IncludedTypeEnum.ALL)) {
        allDataUsedForScaling.doClick();
    } else {
        includedDataUsedForScaling.doClick();
    }

}
 
源代码4 项目: netbeans   文件: Reset.java
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);
}
 
private int getTestingType() {
  for (int i = 0, myTestingType2RadioButtonLength = testingType2RadioButton.length;
      i < myTestingType2RadioButtonLength;
      i++) {
    JRadioButton button = testingType2RadioButton[i];
    if (button.isSelected()) {
      return i;
    }
  }
  return -1;
}
 
源代码6 项目: rapidminer-studio   文件: SelectionDialog.java
/**
 * Checks, if the specified radio button is selected.
 *
 * @param index
 *            Index of the radio button to examine
 * @return true, if the radio button is selected
 */
public boolean isOptionSelected(int index) {
	if (index >= selectionPanel.getComponents().length) {
		return false;
	}
	JRadioButton radioButton = (JRadioButton) selectionPanel.getComponent(index);
	if (radioButton.isSelected()) {
		return true;
	} else {
		return false;
	}
}
 
源代码7 项目: rapidminer-studio   文件: SelectionDialog.java
/**
 * Checks, if the specified radio button containing the i18n String of the given key is
 * selected.
 *
 * @param key
 *            i18n key
 * @return true, if a matching radio button is selected
 */
public boolean isOptionSelected(String key) {
	for (int i = 0; i < selectionPanel.getComponents().length; i++) {
		JRadioButton radioButton = (JRadioButton) selectionPanel.getComponent(i);
		if (radioButton.getText().equals(getI18n(key))) {
			if (radioButton.isSelected()) {
				return true;
			} else {
				return false;
			}
		}
	}
	return false;
}
 
源代码8 项目: jeveassets   文件: StockpileImportDialog.java
private void selected(JRadioButton jRadioButton, ImportReturn single, ImportReturn all) {
	if (jRadioButton.isSelected()) {
		if (jAll.isSelected()) {
			importReturn = all;
		} else {
			importReturn = single;
		}
	}
}
 
protected boolean accept(Component c) {
    for (int i = 0; i < group.length; i++) {
        if (isSkipUnselected && group[i].contains(c)) {
            JRadioButton b = (JRadioButton) c;
            if (group[i].getSelection() != null && !b.isSelected()) {
                return false;
            }
        }
    }
    return super.accept(c);
}
 
源代码10 项目: beautyeye   文件: LayoutControlPanel.java
public void actionPerformed(ActionEvent e) {
    JRadioButton rb = (JRadioButton) e.getSource();
    if(!rb.isSelected()) {
               return;
           }
           String cmd = rb.getActionCommand();
           int hPos, vPos;
           if(cmd.equals("NW")) {
                   hPos = LEFT; vPos = TOP;
           } else if(cmd.equals("N")) {
                   hPos = CENTER; vPos = TOP;
           } else if(cmd.equals("NE")) {
                   hPos = RIGHT; vPos = TOP;
           } else if(cmd.equals("W")) {
                   hPos = LEFT; vPos = CENTER;
           } else if(cmd.equals("C")) {
                   hPos = CENTER; vPos = CENTER;
           } else if(cmd.equals("E")) {
                   hPos = RIGHT; vPos = CENTER;
           } else if(cmd.equals("SW")) {
                   hPos = LEFT; vPos = BOTTOM;
           } else if(cmd.equals("S")) {
                   hPos = CENTER; vPos = BOTTOM;
           } else /*if(cmd.equals("SE"))*/ {
                   hPos = RIGHT; vPos = BOTTOM;
           }
           for(int i = 0; i < demo.getCurrentControls().size(); i++) {
               Component c = (Component) demo.getCurrentControls().elementAt(i);
               setPosition(c, hPos, vPos);
           }
           demo.invalidate();
           demo.validate();
           demo.repaint();
}
 
源代码11 项目: ib-controller   文件: GatewayLoginFrameHandler.java
private void switchToIBAPI(Window window) throws IBControllerException {
    JRadioButton button = SwingUtils.findRadioButton(window, "IB API");
    if (button == null) button = SwingUtils.findRadioButton(window, "TWS/API") ;
    if (button == null) throw new IBControllerException("IB API radio button");
    
    if (! button.isSelected()) button.doClick();
}
 
源代码12 项目: atdl4j   文件: SwingRadioButtonListWidget.java
public String getControlValueRaw()
{
	for ( int i = 0; i < this.buttons.size(); i++ )
	{
		JRadioButton b = buttons.get( i );
		if ( b.isSelected() )
		{
			return ( (RadioButtonListT) control ).getListItem().get( i ).getEnumID();
		}
	}
	return null;
}
 
源代码13 项目: OpenDA   文件: Query.java
/** Get the current value in the entry with the given name,
 *  and return as a String.  All entry types support this.
 *  Note that this method should be called from the event dispatch
 *  thread, since it needs to query to UI widgets for their current
 *  values.  If it is called from another thread, there is no
 *  assurance that the value returned will be the current value.
 *  @return The value currently in the entry as a String.
 *  @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 type does not
 *   have a string representation (this should not be thrown).
 */
public String getStringValue(String name)
    throws NoSuchElementException, IllegalArgumentException {
    Object result = _entries.get(name);
    if (result == null) {
        throw new NoSuchElementException(
            "No item named \"" + name + " \" in the query box.");
    }
    // FIXME: Surely there is a better way to do this...
    // We should define a set of inner classes, one for each entry type.
    // Currently, this has to be updated each time a new entry type
    // is added.
    if (result instanceof JTextField) {
        return ((JTextField) result).getText();
    } else if (result instanceof QueryColorChooser) {
        return ((QueryColorChooser) result).getSelectedColor();
    } else if (result instanceof QueryFileChooser) {
        return ((QueryFileChooser) result).getSelectedFileName();
    } else if (result instanceof JTextArea) {
        return ((JTextArea) result).getText();
    } else if (result instanceof JRadioButton) {
        JRadioButton radioButton = (JRadioButton) result;
        if (radioButton.isSelected()) {
            return "true";
        } else {
            return "false";
        }
    } else if (result instanceof JSlider) {
        return "" + ((JSlider) result).getValue();
    } else if (result instanceof JComboBox) {
        return (String) (((JComboBox) result).getSelectedItem());
    } else if (result instanceof JRadioButton[]) {
        // Regrettably, ButtonGroup gives no way to determine
        // which button is selected, so we have to search...
        JRadioButton[] buttons = (JRadioButton[]) result;
        String toReturn = null;
        for (int i = 0; i < buttons.length; i++) {
            if (buttons[i].isSelected()) {
                if (toReturn == null)
                    toReturn = buttons[i].getText();
                else
                    toReturn = toReturn + ", " + buttons[i].getText();
            }
        }
        if (toReturn == null)
            toReturn = "";
        return toReturn;
    } else if (result instanceof QueryScrollPane) {
        return ((QueryScrollPane) result).getText();
    } else {
        throw new IllegalArgumentException(
            "Query class cannot generate"
                + " a string representation for entries of type "
                + result.getClass());
    }
}
 
源代码14 项目: netbeans   文件: GroovyJUnitTestWizard.java
private JUnit askUserWhichJUnitToUse() {
    JRadioButton radioButtonForJUnit3 = new JRadioButton();
    JRadioButton radioButtonForJUnit4 = new JRadioButton();

    Mnemonics.setLocalizedText(radioButtonForJUnit3, BUNDLE.getString("LBL_JUnit3_generator"));                       //NOI18N
    Mnemonics.setLocalizedText(radioButtonForJUnit4, BUNDLE.getString("LBL_JUnit4_generator"));                       //NOI18N

    radioButtonForJUnit3.getAccessibleContext().setAccessibleDescription(BUNDLE.getString("AD_JUnit3_generator"));    //NOI18N
    radioButtonForJUnit4.getAccessibleContext().setAccessibleDescription(BUNDLE.getString("AD_JUnit4_generator"));    //NOI18N

    ButtonGroup group = new ButtonGroup();
    group.add(radioButtonForJUnit3);
    group.add(radioButtonForJUnit4);
    radioButtonForJUnit4.setSelected(true);

    JComponent msg = createMultilineLabel(BUNDLE.getString("MSG_select_junit_version")); //NOI18N
    JPanel choicePanel = new JPanel(new GridLayout(0, 1, 0, 3));
    choicePanel.add(radioButtonForJUnit3);
    choicePanel.add(radioButtonForJUnit4);

    JPanel panel = new JPanel(new BorderLayout(0, 12));
    panel.add(msg, BorderLayout.NORTH);
    panel.add(choicePanel, BorderLayout.CENTER);

    JButton button = new JButton();
    Mnemonics.setLocalizedText(button, BUNDLE.getString("LBL_Select"));     //NOI18N
    button.getAccessibleContext().setAccessibleDescription("AD_Select");    //NOI18N
    button.getAccessibleContext().setAccessibleName("AN_Select");           //NOI18N

    Object answer = DialogDisplayer.getDefault().notify(
            new DialogDescriptor(
                    wrapDialogContent(panel),
                    BUNDLE.getString("LBL_title_select_generator"),         //NOI18N
                    true,
                    new Object[] {button, NotifyDescriptor.CANCEL_OPTION},
                    button,
                    DialogDescriptor.DEFAULT_ALIGN,
                    null,
                    (ActionListener) null));

    if (answer == button) {
        if (radioButtonForJUnit3.isSelected()) {
            return JUnit.JUNIT3;
        } else {
            return JUnit.JUNIT4;
        }
    } else {
        return null;
    }
}
 
源代码15 项目: uima-uimaj   文件: CasAnnotationViewer.java
/**
 * Check if an annotation matches the filters set by the user. If true, the
 * annotation will be added to the annotation tree display panel.
 *
 * @param annotation the annotation
 * @return true, if is match
 */
private boolean isMatch(Annotation annotation) {
  Type type = annotation.getType();
  switch (this.viewMode) {
    case MODE_ANNOTATIONS:
      if (this.typeToCheckBoxMap.size() == 0) {
        return false;
      }
      JCheckBox typeCheckBox = this.typeToCheckBoxMap.get(type);
      return typeCheckBox != null && typeCheckBox.isSelected();
    case MODE_ENTITIES:
      if (this.entityToCheckBoxMap.size() == 0) {
        return false;
      }
      Entity entity = this.entityResolver.getEntity(annotation);
      if (entity == null) {
        return false;
      }
      JCheckBox entityCheckBox = this.entityToCheckBoxMap.get(entity);
      return entityCheckBox != null && entityCheckBox.isSelected();
    case MODE_FEATURES:
      JRadioButton typeRadioButton = this.typeRadioButtonMap.get(type);
      if (typeRadioButton == null || !typeRadioButton.isSelected()) {
        return false;
      }
      List<Feature> features = type.getFeatures();
      if (features == null || features.size() == 0) {
        return false;
      }
      for (Feature feature : features) {
        String featureName = feature.getShortName();
        if (featureName == null || featureName.length() == 0) {
          continue;
        }
        JRadioButton featureRadioButton = this.featureRadioButtonMap.get(featureName);
        if (featureRadioButton == null || !featureRadioButton.isSelected()) {
          continue;
        }
        String featureValue = this.getFeatureValueInString(annotation, feature);
        if (featureValue == null || featureValue.length() == 0) {
          continue;
        }
        JCheckBox featureValueCheckBox = this.featureValueCheckBoxMap.get(featureValue);
        return featureValueCheckBox != null && featureValueCheckBox.isSelected();
      }
      break;
    default:
      break;
  }
  return false;
}
 
源代码16 项目: ib-controller   文件: GatewayLoginFrameHandler.java
private void switchToFIX(Window window) throws IBControllerException {
    JRadioButton button = SwingUtils.findRadioButton(window, "FIX CTCI");
    if (button == null) throw new IBControllerException("FIX CTCI radio button");
    
    if (! button.isSelected()) button.doClick();
}
 
源代码17 项目: IBC   文件: SwingUtils.java
/**
 * Indicates whether the specified JRadioButton is selected.
 * @param window
 * the window in which to search for the required JRadioButton
 * @param buttonText
 * the label of the required JRadioButton
 * @return
 * true if the JRadioButton is enabled; false if there is no such JRadioButton, or it
 * is not selected
 */
static boolean isRadioButtonSelected(Window window, String buttonText) {
    final JRadioButton rb = findRadioButton(window, buttonText);
    if (rb == null) return false;

    return rb.isSelected();

}
 
源代码18 项目: IBC   文件: SwingUtils.java
/**
 * Sets or clears the specified JRadioButton .
 * @param window
 * the window in which to search for the required JRadioButton 
 * @param buttonText
 * the label for the required JRadioButton 
 * @param value
 * true to set the JRadioButton ; false to clear it
 * @return
 * true if the JRadioButton  was found; otherwise false
 */
static boolean setRadioButtonSelected(Window window, String buttonText) {
    final JRadioButton rb = findRadioButton(window, buttonText);
    if (rb == null) return false;

    if (rb.isSelected()) return true;

    rb.doClick();
    return true;
}
 
源代码19 项目: ib-controller   文件: SwingUtils.java
/**
 * Indicates whether the specified JRadioButton is selected.
 * @param window
 * the window in which to search for the required JRadioButton
 * @param buttonText
 * the label of the required JRadioButton
 * @return
 * true if the JRadioButton is enabled; false if there is no such JRadioButton, or it
 * is not selected
 */
static boolean isRadioButtonSelected(Window window, String buttonText) {
    final JRadioButton rb = findRadioButton(window, buttonText);
    if (rb == null) return false;

    return rb.isSelected();

}
 
源代码20 项目: ib-controller   文件: SwingUtils.java
/**
 * Sets or clears the specified JRadioButton .
 * @param window
 * the window in which to search for the required JRadioButton 
 * @param buttonText
 * the label for the required JRadioButton 
 * @param value
 * true to set the JRadioButton ; false to clear it
 * @return
 * true if the JRadioButton  was found; otherwise false
 */
static boolean setRadioButtonSelected(Window window, String buttonText) {
    final JRadioButton rb = findRadioButton(window, buttonText);
    if (rb == null) return false;

    if (rb.isSelected()) return true;

    rb.doClick();
    return true;
}