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

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

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

JComboBox.actionPerformed介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project

public void actionPerformed(ActionEvent e) {
  combo.actionPerformed(e);
}

代码示例来源:origin: org.activecomponents.jadex/jadex-commons-gui

public boolean stopCellEditing()
{
  if(box.isEditable())
  {
    // Commit edited value.
    box.actionPerformed(new ActionEvent(AutoComboTableCellEditor.this, 0, ""));
  }
  return super.stopCellEditing();
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

@Override
public boolean stopCellEditing() {
  if (comboBox.isEditable()) {
    // Commit edited value.
    comboBox.actionPerformed(new ActionEvent(ComboBoxCellEditor.this, 0, ""));
  }
  return super.stopCellEditing();
}

代码示例来源:origin: net.sf.cuf/cuf-swing

public boolean stopCellEditing()
  {
    if (comboBox.isEditable())
    {
      // Commit edited value.
      comboBox.actionPerformed(new ActionEvent(LOVCellEditor.this, 0, ""));
    }
    return super.stopCellEditing();
  }
};

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

@Override
public boolean stopCellEditing() {
  if (comboBox.isEditable()) {
    // Notify the combo box that editing has stopped (e.g. User pressed F2)
    comboBox.actionPerformed(new ActionEvent(this, 0, ""));
  }
  fireEditingStopped();
  return true;
}

代码示例来源:origin: tmyroadctfig/swingx

@Override
public boolean stopCellEditing() {
  if (comboBox.isEditable()) {
    // Commit edited value.
    comboBox.actionPerformed(new ActionEvent(ComboBoxCellEditor.this, 0, ""));
  }
  return super.stopCellEditing();
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * Tells the combo box to stop editing and accept any partially edited value as the value of the combo box.
 * Always returns true.
 * @return true
 */
public boolean stopCellEditing() {
  if (comboBox.isEditable()) {
    // Notify the combo box that editing has stopped (e.g. User pressed F2)
    comboBox.actionPerformed(new ActionEvent(this, 0, ""));
  }
  fireEditingStopped();
  return true;
}

代码示例来源:origin: jsettlers/settlers-remake

@Override
public void actionPerformed(ActionEvent actionEvent) {
  super.actionPerformed(actionEvent);
  if(actionEvent.getActionCommand() == "comboBoxChanged") {
    EBackendType bi = (EBackendType) getSelectedItem();
    if (bi.platform != null && bi.platform != Platform.get()) {
      setSelectedItem(current_item);
      BackendSelector.this.hidePopup();
      JOptionPane.showMessageDialog(BackendSelector.this.getParent(), bi.cc_name + " is only available on " + bi.platform);
    } else {
      current_item = bi;
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

/**
   * This will make the comboBox fire an ActionEvent if the editor
   * value is different from the selected item in the model.  
   * This allows for the entering of data in the combo box editor and
   * sends notification when tabbing or clicking out of focus.
   */
  public void focusLost(FocusEvent e)
  {
    ComboBoxEditor editor= comboBox.getEditor();
    Object item= editor.getItem();
    if (!e.isTemporary()
      && item != null
      && !item.equals(comboBox.getSelectedItem()))
    {
      comboBox.actionPerformed(
        new ActionEvent(
          editor,
          0,
          "",
          EventQueue.getMostRecentEventTime(),
          0));
    }
  }
}

代码示例来源:origin: pentaho/pentaho-reporting

/**
 * Tells the editor to stop editing and accept any partially edited value as the value of the editor.  The editor
 * returns false if editing was not stopped; this is useful for editors that validate and can not accept invalid
 * entries.
 *
 * @return true if editing was stopped; false otherwise
 */
public boolean stopCellEditing() {
 try {
  // ugly hack to make the combobox editor commit any changes before we go out of focus.
  comboBox.actionPerformed( new ActionEvent( this, ActionEvent.ACTION_PERFORMED, comboBox.getActionCommand() ) );
  fireEditingStopped();
  return true;
 } catch ( final Exception e ) {
  DebugLog.log( "Exception caught while editing cell-value", e ); // NON-NLS
  // exception ignored
  fireEditingCanceled();
  return true;
 }
}

代码示例来源:origin: pentaho/pentaho-reporting

/**
 * Tells the editor to stop editing and accept any partially edited value as the value of the editor.  The editor
 * returns false if editing was not stopped; this is useful for editors that validate and can not accept invalid
 * entries.
 *
 * @return true if editing was stopped; false otherwise
 */
public boolean stopCellEditing() {
 try {
  // ugly hack to make the combobox editor commit any changes before we go out of focus.
  comboBox.actionPerformed( new ActionEvent( this, ActionEvent.ACTION_PERFORMED, comboBox.getActionCommand() ) );
  fireEditingStopped();
  return true;
 } catch ( final Exception e ) {
  DebugLog.log( "Error on Stop", e );
  // exception ignored
  fireEditingCanceled();
  return true;
 }
}

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

int selectedIndex = comboModel.getIndexOf(selectedItem);
if (!(selectedIndex == -1)) {
  comboBox.actionPerformed(new ActionEvent(this, selectedIndex, "blabla"));
} else if (selectedItem != null) {

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

if (comboBox.isEditable()) {
  comboBox.actionPerformed(new ActionEvent(ComboBoxCellEditor.this, 0, ""));

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

comboBox.actionPerformed(new ActionEvent(this, 0, ""));

相关文章

JComboBox类方法