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

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

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

JComboBox.getName介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

if(e.getSource() instanceof JComboBox){
 JComboBox combo = (JComboBox) e.getSource();

  if("combo1".equals(combo.getName())){
    // your code
  }
  .
  .// rest of code
}

代码示例来源:origin: stackoverflow.com

private void comboBoxActionPerformed(java.awt.event.ActionEvent evt) {                                                

  JComboBox source = (JComboBox) evt.getSource();

  //     "comboBoxChanged" is the default, 
  // so any normal JComboBox can also use this action listener
  if (evt.getActionCommand().equals("comboBoxChanged")) {
    updateModel(source.getName(), (String) source.getSelectedItem());
  }
}

代码示例来源:origin: stackoverflow.com

if (temp.getName().equalsIgnoreCase("Hotel Selection"))
else if (temp.getName().equalsIgnoreCase("No of people"))
else if (temp.getName().equalsIgnoreCase("Day of booking"))

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

@Override
public void itemStateChanged(ItemEvent e) {
  if (e.getSource() instanceof JComboBox) {
    JComboBox combo = (JComboBox) e.getSource();
    if(ProxyControlGui.HTTP_SAMPLER_NAMING_MODE.equals(combo.getName())){
      recorderGui.setHTTPSampleNamingMode(httpSampleNamingMode.getSelectedIndex());
    }
  }
  else {
    recorderGui.enableRestart();
  }
}

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

/** {@inheritDoc} */
@Override
public void itemStateChanged(ItemEvent e) {
  if (e.getSource() instanceof JComboBox) {
    JComboBox combo = (JComboBox) e.getSource();
    if(HTTP_SAMPLER_NAMING_MODE.equals(combo.getName())){
      model.setHTTPSampleNamingMode(httpSampleNamingMode.getSelectedIndex());
      }
    }
  else {
    enableRestart();
  }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-swing-action

/**
 * @param component             le select box où rattacher l'action
 * @param action                action
 * @param configurationResolver initializer
 */
protected void finalizeNewAction(JComboBox component, MyAbstractAction action, ActionConfigurationResolver<?, ?> configurationResolver) {
  if (configurationResolver == null) {
    action.putValue(Action.ACTION_COMMAND_KEY, component.getName());
    action.putValue(Action.SHORT_DESCRIPTION, component.getToolTipText());
    //result.putValue("selectedIndex", component.getSelectedIndex());
  }
}

代码示例来源:origin: nl.cloudfarming.client/field-shape-type

@Override
  public void itemStateChanged(ItemEvent evt) {
    JComboBox cb = (JComboBox) evt.getSource();
    String boxName = cb.getName();
    // Get the affected item
    Object item = evt.getItem();
    if (evt.getStateChange() == ItemEvent.SELECTED) {
      // Item was just selected
      if (ShapePropertyMappingPanel.PROP_COMBOBOX_NAME.equals(boxName)) {
        for (Shape shape : dataObject.getShapes()) {
          shape.setNameFromAttribute((String) item);
        }
      }
      if (ShapePropertiesPanel.PROP_COMBOBOX_IMPORT_TYPE.equals(boxName)) {
        for (Object o : scene.getSelectedObjects()) {
          ((Shape) o).setImportType((Shape.ImportType) item);
        }
      }
    } else if (evt.getStateChange() == ItemEvent.DESELECTED) {
      // Item is no longer selected
    }
  }
}

代码示例来源:origin: joel-costigliola/assertj-swing

/**
 * Returns the {@code String} representation of the given {@code Component}, which should be a {@code JComboBox}.
 *
 * @param c the given {@code Component}.
 * @return the {@code String} representation of the given {@code JComboBox}.
 */
@RunsInCurrentThread
@Override
@Nonnull protected String doFormat(@Nonnull Component c) {
 JComboBox<?> comboBox = (JComboBox<?>) c;
 String format = "%s[name=%s, selectedItem=%s, contents=%s, editable=%b, enabled=%b, visible=%b, showing=%b]";
 return String.format(format, getRealClassName(c), quote(comboBox.getName()),
            quote(comboBox.getSelectedItem()), Arrays.format(contentsOf(comboBox)), comboBox.isEditable(),
            comboBox.isEnabled(), comboBox.isVisible(), comboBox.isShowing());
}

代码示例来源:origin: nl.cloudfarming.client/geometry-shape-type

@Override
public void itemStateChanged(ItemEvent evt) {
  JComboBox cb = (JComboBox) evt.getSource();
  String boxName = cb.getName();

相关文章

JComboBox类方法