javax.swing.JComboBox.getSelectedIndex()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(351)

本文整理了Java中javax.swing.JComboBox.getSelectedIndex()方法的一些代码示例,展示了JComboBox.getSelectedIndex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.getSelectedIndex()方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:getSelectedIndex

JComboBox.getSelectedIndex介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

options.setProperty("silenceDuration", String.valueOf(silenceDuration));
int audioSourceIndex = cbAudioSource.getSelectedIndex();
int expertOutputIndex = cbExpertOutput.getSelectedIndex();
int speakerOutputIndex = cbSpeakerOutput.getSelectedIndex();
options.setProperty("redAlertMode", String.valueOf(redAlertMode));
options.setProperty("samplingRate", (String) cbSamplingRate.getSelectedItem());
options.setProperty("bitsPerSample", (String) cbBitsPerSample.getSelectedItem());
options.setProperty("monoStereo", (String) cbMonoStereo.getSelectedItem());
options.setProperty("expertBitsPerSample", (String) cbExpertBitsPerSample.getSelectedItem());
options.setProperty("expertMonoStereo", (String) cbExpertMonoStereo.getSelectedItem());

代码示例来源:origin: magefree/mage

private void cbExpansionSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbExpansionSetActionPerformed
  if (!cbExpansionSet.getSelectedItem().toString().contains(TEST_MULTI_SET)) {
    int index = cbExpansionSet.getSelectedIndex();
    if (cbExpansionSet.getItemAt(0).contains(TEST_MULTI_SET)) {
      cbExpansionSet.removeItemAt(0);
      index--;
    }
    listCodeSelected.uncheckAll();
    if (index > 0) {
      //ofset because all sets is removed from the list
      listCodeSelected.setChecked(index - 1, true);
    }
  }
  filterCards();
}//GEN-LAST:event_cbExpansionSetActionPerformed

代码示例来源:origin: xyz.cofe/gui.swing

@Override
public Object getValue() {
  int selIdx = combo.getSelectedIndex();
  if( selIdx==nullIndex && allowNull )return null;
  
  return combo.getSelectedItem();
}

代码示例来源:origin: net.sf.squirrel-sql.plugins/smarttools

private String getWhereCondition(String columnName, String value)
{
  if (cbOperator.getSelectedIndex() > 0)
  {
    return " where " + columnName + " " + (String) cbOperator.getSelectedItem() + " " + value;
  }
  else
  {
    return "";
  }
}

代码示例来源:origin: org.zaproxy/zap

@Override
  public void actionPerformed(java.awt.event.ActionEvent e) {    
    String item = (String) siteSelect.getSelectedItem();
    if (item != null && siteSelect.getSelectedIndex() > 0) {
      siteSelected(item);
    }
  }
});

代码示例来源:origin: com.synaptix/SynaptixWidget

@Override
public String getValue() {
  if (comboBox.getSelectedIndex() == 0) {
    return null;
  }
  return (String) comboBox.getSelectedItem();
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui

public SharingPolicy getChosenPermission() {
  if (permissionBox.getSelectedIndex() < 0)
    return null;
  return permissionMap.get(permissionBox.getSelectedItem());
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui

public Family getChosenFamily() {
  if (familyBox.getSelectedIndex() >= 0)
    return familyMap.get(familyBox.getSelectedItem());
  return null;
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui

public Profile getChosenProfile() {
  if (profileBox.getSelectedIndex() < 0)
    return null;
  return profileMap.get(profileBox.getSelectedItem());
}

代码示例来源:origin: org.boofcv/visualize

/**
 * Tells it to switch again to the current algorithm.  Useful if the input has changed and information
 * needs to be rendered again.
 */
public void refreshAlgorithm() {
  Object cookie = algCookies.get(algBox.getSelectedIndex());
  String name = (String)algBox.getSelectedItem();
  performSetAlgorithm(name, cookie);
}

代码示例来源:origin: org.apache.jmeter/jorphan

@Override
  public void actionPerformed(ActionEvent e) {
    String item = (String) choiceList.getSelectedItem();
    int index = choiceList.getSelectedIndex();
    if (!item.equals(choiceList.getItemAt(index))) {
      choiceList.addItem(item);
    }
    choiceList.setSelectedItem(item);
    notifyChangeListeners();
  }
}

代码示例来源:origin: org.boofcv/visualize

@Override
public void actionPerformed(ActionEvent e) {
  if( e.getSource() == algBox ) {
    final Object cookie = algCookies.get(algBox.getSelectedIndex());
    final String name = (String)algBox.getSelectedItem();
    new Thread() {
      public void run() {
        performSetAlgorithm(name, cookie);
      }
    }.start();
  }
}

代码示例来源:origin: org.boofcv/boofcv-swing

/**
 * Tells it to switch again to the current algorithm.  Useful if the input has changed and information
 * needs to be rendered again.
 */
public void refreshAlgorithm() {
  Object cookie = algCookies.get(algBox.getSelectedIndex());
  String name = (String)algBox.getSelectedItem();
  performSetAlgorithm(name, cookie);
}

代码示例来源:origin: org.boofcv/boofcv-swing

@Override
public void actionPerformed(ActionEvent e) {
  if( e.getSource() == algBox ) {
    final Object cookie = algCookies.get(algBox.getSelectedIndex());
    final String name = (String)algBox.getSelectedItem();
    new Thread() {
      public void run() {
        performSetAlgorithm(name, cookie);
      }
    }.start();
  }
}

代码示例来源:origin: org.zaproxy/zap

private void saveMethod() {
  Integer selectedStatusCode = (Integer) (statusCodeComboBox.getSelectedIndex() == 0 ? null
      : statusCodeComboBox.getSelectedItem());
  LogicalOperator selectedComposition = logicalOperatorComboBox.getSelectedItem().equals(
      FIELD_VALUE_AND_COMPOSITION) ? LogicalOperator.AND : LogicalOperator.OR;
  authorizationMethod = new BasicAuthorizationDetectionMethod(selectedStatusCode,
      headerPatternText.getText(), bodyPatternText.getText(), selectedComposition);
}

代码示例来源:origin: net.sf.meka/meka

@Override
  public void actionPerformed(ActionEvent e) {
    if (m_IgnoreChanges)
      return;
    if (m_ComboBoxMeasurements.getSelectedIndex() == -1)
      return;
    m_ModelMeasurement.setMeasurement((String) m_ComboBoxMeasurements.getSelectedItem());
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public Project getSelectedProject() {
  Object selectedItem = projectComboBox.getSelectedItem();
  if (selectedItem instanceof ProjectCBItem) {
    noproject = false;
    return ((ProjectCBItem)selectedItem).getProject();
  }
  // set noproject if NO_PROJECT is selected
  noproject = (projectComboBox.getSelectedIndex() == 0);
  return null;
}

代码示例来源:origin: com.darwinsys/darwinsys-api

public void actionPerformed(ActionEvent e) {
    if (inTemplateChoice.getSelectedIndex() == 0) {
      return;
    }
    final SQLTemplate selectedItem = (SQLTemplate) inTemplateChoice.getSelectedItem();
    inputTextArea.setText(selectedItem.getTemplate());
  }
});

代码示例来源:origin: IanDarwin/javasrc

public void actionPerformed(ActionEvent ae) {
    int i = yearChoice.getSelectedIndex();
    if (i>=0) {
      yy = Integer.parseInt(yearChoice.getSelectedItem().toString());
      // System.out.println("Year=" + yy);
      recompute();
    }
  }
});

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
 public void actionPerformed(ActionEvent e) {
if (m_ComboBoxPanels.getSelectedIndex() == -1)
 return;
AbstractSetupPanel panel = (AbstractSetupPanel) m_ComboBoxPanels.getSelectedItem();
switchTo(panel, null);
 }
});

相关文章

JComboBox类方法