Package javax.swing

Examples of javax.swing.DefaultComboBoxModel.insertElementAt()


        List<FurnitureCategory> categories = catalog.getCategories();
        if (!categories.contains(category)) {
          model.removeElement(category);
          furnitureCatalogPanel.categoryFilterComboBox.setSelectedIndex(0);
        } else if (model.getIndexOf(category) == -1) {
          model.insertElementAt(category, categories.indexOf(category) + 1);
        }
      }
    }
  }
View Full Code Here


            // Iterate through the list of presets given. From the description
            // look-up the resource bundle for the display string.
            int i = 0;
            for (ConfigElement ce : elements) {
                String description = ce.getDescription();
                m.insertElementAt(PRESETS_BUNDLE.getString(description), i);
                i++;
            }
        } finally {
            setLocalChanges(false);
        }
View Full Code Here

   * Creates a new color combobox and populates it with the excel colors.
   */
  public ColorComboBox()
  {
    final DefaultComboBoxModel model = new DefaultComboBoxModel(ColorUtility.getPredefinedExcelColors());
    model.insertElementAt(null, 0);
    model.setSelectedItem(null);

    setModel(model);
    setRenderer(new ColorCellRenderer());
    final int height1 = getPreferredSize().height;
View Full Code Here

  public void test(TestHarness harness)     
  {  
    DefaultComboBoxModel m = new DefaultComboBoxModel();
    m.addListDataListener(this);
   
    m.insertElementAt("A", 0);
    harness.check(m.getSize(), 1);
    harness.check(m.getElementAt(0), "A");
    harness.check(m.getSelectedItem(), null);
    harness.check(eventType, ListDataEvent.INTERVAL_ADDED);
    harness.check(index0, 0);
View Full Code Here

    harness.check(m.getSelectedItem(), null);
    harness.check(eventType, ListDataEvent.INTERVAL_ADDED);
    harness.check(index0, 0);
    harness.check(index1, 0);
   
    m.insertElementAt("B", 1);
    harness.check(m.getSize(), 2);
    harness.check(m.getElementAt(1), "B");
    harness.check(m.getSelectedItem(), null);
    harness.check(eventType, ListDataEvent.INTERVAL_ADDED);
    harness.check(index0, 1);
View Full Code Here

    harness.check(m.getSelectedItem(), null);
    harness.check(eventType, ListDataEvent.INTERVAL_ADDED);
    harness.check(index0, 1);
    harness.check(index1, 1);
   
    m.insertElementAt("C", 0);
    harness.check(m.getSize(), 3);
    harness.check(m.getElementAt(0), "C");
    harness.check(m.getSelectedItem(), null);
    harness.check(eventType, ListDataEvent.INTERVAL_ADDED);
    harness.check(index0, 0);
View Full Code Here

    harness.check(m.getSelectedItem(), null);
    harness.check(eventType, ListDataEvent.INTERVAL_ADDED);
    harness.check(index0, 0);
    harness.check(index1, 0);

    m.insertElementAt(null, 0);
    harness.check(m.getSize(), 4);
    harness.check(m.getElementAt(0), null);
    harness.check(m.getSelectedItem(), null);
    harness.check(eventType, ListDataEvent.INTERVAL_ADDED);
    harness.check(index0, 0);
View Full Code Here

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

   
    // try index too large
    pass = false;
    try
    {
      m.insertElementAt("Z", 5);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      pass = true;
    }
View Full Code Here

      public void focusGained(FocusEvent e) {}
    });
    baseUrlField = new SmartComboBox();
    baseUrlField.setEditable(true);
    final DefaultComboBoxModel comboBoxModel = new DefaultComboBoxModel(context.getDataSchemaModel().getColumnNames());
    comboBoxModel.insertElementAt(null, 0);
    comboBoxModel.setSelectedItem(null);
    baseUrlField.setModel(comboBoxModel);
    solution = new JTextField();
    path = new JTextField();
    file = new JTextField();
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.