Package javax.swing

Examples of javax.swing.DefaultComboBoxModel.removeElementAt()


  public void test(TestHarness harness)     
  {  
    DefaultComboBoxModel m = new DefaultComboBoxModel(new Object[] {"A", "B", "C"});
    m.addListDataListener(this);
   
    m.removeElementAt(0);
    harness.check(m.getSize(), 2);
    harness.check(m.getElementAt(0), "B");
    harness.check(m.getSelectedItem(), "B");
    harness.check(eventType, ListDataEvent.INTERVAL_REMOVED);
    harness.check(index0, 0);
View Full Code Here


    harness.check(m.getSelectedItem(), "B");
    harness.check(eventType, ListDataEvent.INTERVAL_REMOVED);
    harness.check(index0, 0);
    harness.check(index1, 0);
   
    m.removeElementAt(1);
    harness.check(m.getSize(), 1);
    harness.check(m.getElementAt(0), "B");
    harness.check(m.getSelectedItem(), "B");
    harness.check(eventType, ListDataEvent.INTERVAL_REMOVED);
    harness.check(index0, 1);
View Full Code Here

   
    // try negative index
    boolean pass = false;
    try
    {
      m.removeElementAt(-1);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;
    }
View Full Code Here

    harness.check(pass);
   
    pass = false;
    try
    {
      m.removeElementAt(1);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;
    }
View Full Code Here

    }
    harness.check(pass);
   
    m = new DefaultComboBoxModel(new Object[] {"A", "B", "C"});
    m.setSelectedItem("B");
    m.removeElementAt(1);
    harness.check(m.getSelectedItem(), "A");
  }
}
View Full Code Here

    }

    void deleteApdu() {
        DefaultComboBoxModel model = (DefaultComboBoxModel) this.apduComboBox.getModel();
        int sel = this.apduComboBox.getSelectedIndex();
        model.removeElementAt(sel);
    }

    class deleteAction implements javax.swing.Action {

        public Object getValue(String key) {
View Full Code Here

    String selectedItem = getValue();
    DefaultComboBoxModel model = new DefaultComboBoxModel( values );

    if( values.length > 0 && values[0] == null )
    {
      model.removeElementAt( 0 );
      getComponent().setEditable( true );
    }
    else
    {
      getComponent().setEditable( false );
View Full Code Here

    for (int i = 1; // index 0 does not contain a FilterComponent object
    i < mRuleCb.getItemCount(); i++) {
      FilterComponent c = (FilterComponent) mRuleCb.getItemAt(i);
      if (c.toString().equals(comp.toString())) {
        DefaultComboBoxModel model = (DefaultComboBoxModel) mRuleCb.getModel();
        model.removeElementAt(i);
        model.insertElementAt(comp, i);
        mRuleCb.setSelectedIndex(i);
        mNameTF.setText(comp.getName());
        mDescTF.setText(comp.getDescription());
        break;
View Full Code Here

  private void addUrl(final String selectedItem) {
    final DefaultComboBoxModel model = (DefaultComboBoxModel) getModel();
    for (int i = 0; i < model.getSize(); i++) {
      final String element = (String) model.getElementAt(i);
      if (element.equals(selectedItem)) {
        model.removeElementAt(i);
        break;
      }
    }
    model.insertElementAt(selectedItem, 0);
    setSelectedIndex(0);
View Full Code Here

    public void actionPerformed(final ActionEvent e) {
      final DefaultComboBoxModel model = (DefaultComboBoxModel) elementaryConditionList.getModel();
      final int minSelectionIndex = elementaryConditionList.getMinSelectionIndex();
      int selectedIndex;
      while (0 <= (selectedIndex = elementaryConditionList.getSelectedIndex())) {
        model.removeElementAt(selectedIndex);
      }
      final int size = elementaryConditionList.getModel().getSize();
      if (size > 0) {
        elementaryConditionList.setSelectedIndex(minSelectionIndex < size ? minSelectionIndex : size - 1);
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.