Java 8 DefaultComboBoxModel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DefaultComboBoxModel class.

This code example shows how to use the following methods:removeElementAt
        getComponent().addItem(value); 
    } 
 
    public void setOptions(Object[] values) { 
        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); 
        } 
 
        getComponent().setModel(model);
 
        if (selectedItem != null) {
            getComponent().setSelectedItem(selectedItem);
        } else if (getComponent().isEditable()) { 
            getComponent().setSelectedItem(""); 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addElement, getIndexOf
		return model;
    } 
 
	protected void initializeModel() { 
	    if(model == null){
			model = new DefaultComboBoxModel();
		} 
    } 
	 
	protected boolean applyModel(DefaultComboBoxModel model, int[] selectedIndices) {
		if(selectedIndices.length != 1 && ! acceptMultipleConditions){
			return false; 
		} 
		conditions.clear();
		this.model = model;
		for(int i : selectedIndices){
			conditions.add((ASelectableCondition) model.getElementAt(i));
		} 
	    return true; 
    } 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addElement, getSize, setSelectedItem
    addSwatches(new ExcelColorSchema()); 
  } 
 
  public void addSwatches(final ColorSchema colorSchema)
  { 
    swatches.addElement(colorSchema);
    if (swatches.getSize() == 1)
    { 
      swatches.setSelectedItem(colorSchema);
    } 
  } 
 
  public void removeSwatches(final ColorSchema colorSchema)
  { 
    swatches.removeElement(colorSchema);
  } 
 
  public void clearSwatches() 
  { 
    swatches.removeAllElements();
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addElement, getIndexOf
		return model;
    } 
 
	protected void initializeModel() { 
	    if(model == null){
			model = new DefaultComboBoxModel();
		} 
    } 
	 
	protected boolean applyModel(DefaultComboBoxModel model, int[] selectedIndices) {
		if(selectedIndices.length != 1 && ! acceptMultipleConditions){
			return false; 
		} 
		conditions.clear();
		this.model = model;
		for(int i : selectedIndices){
			conditions.add((ASelectableCondition) model.getElementAt(i));
		} 
	    return true; 
    } 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:insertElementAt, removeElementAt
	public void testListChangeGeneric() { 
		this.extendedComboBoxModel.addListDataListener(this.buildListener());
	 
		this.event = null;
		this.eventType = null;
		this.comboBoxModel.insertElementAt("E", 4);
		this.verifyEvent(ADD, 7);
		 
		this.event = null;
		this.eventType = null;
		this.comboBoxModel.insertElementAt(null, 5);
		this.verifyEvent(ADD, 8);
		 
		this.event = null;
		this.eventType = null;
		this.comboBoxModel.removeElementAt(5);
		this.verifyEvent(REMOVE, 8);
		 
		this.event = null;
		this.eventType = null;

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addElement
	{ 
		return "Rule Effect:"; 
	} 
	protected ComboBoxModel getComboModel()
	{ 
		final DefaultComboBoxModel model = new DefaultComboBoxModel();
		model.addElement(PERMIT);
		model.addElement(DENY);
		return model;
	} 
	protected Object getComboPrototype() 
	{ 
		return PERMIT;
	} 
	public int getEffect() 
	{ 
		final String effect = (String)getSelectedItem();
		if(DENY.equals(effect))
			{return Result.DECISION_DENY;}
		if(PERMIT.equals(effect))
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    @Test
    public void testNPE() { 
        dialog.getComboBox().setEditable(false);
        dialog.getComboBox().setModel(new DefaultComboBoxModel());
        assertNull(mComboBox.getText());
    } 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	                                            final boolean matchApproximately) {
		return TimeCondition.create(simpleCond, (FormattedDate) value);
	} 
 
	public ComboBoxModel getConditionsForProperty(final Object property) {
		return new DefaultComboBoxModel(getTimeConditionNames());
	} 
 
	public ListModel getFilteredProperties() {
		final DefaultListModel list = new DefaultListModel();
		list.addElement(TextUtils.createTranslatedString(FILTER_TIME));
		return list;
	} 
 
	public Object[] getTimeConditionNames() { 
		return new NamedObject[] { TextUtils.createTranslatedString(TimeCondition.FILTER_MODIFIED_AFTER),
		        TextUtils.createTranslatedString(TimeCondition.FILTER_MODIFIED_BEFORE),
		        TextUtils.createTranslatedString(TimeCondition.FILTER_CREATED_AFTER),
		        TextUtils.createTranslatedString(TimeCondition.FILTER_CREATED_BEFORE) };
	} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
			return null; 
		return new ScriptCondition(string);
	} 
 
	public ComboBoxModel getConditionsForProperty(final Object property) {
		return new DefaultComboBoxModel(getScriptConditionNames());
	} 
 
	public ListModel getFilteredProperties() {
		final DefaultListModel list = new DefaultListModel();
		list.addElement(TextUtils.createTranslatedString(FILTER_SCRIPT));
		return list;
	} 
 
	public Object[] getScriptConditionNames() { 
		return new NamedObject[] { new NamedObject(ScriptCondition.NAME, " ")}; 
	} 
 
	public ComboBoxEditor getValueEditor(Object selectedProperty, NamedObject selectedCondition) {
		return editor;
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
        labelColor.setFont(labelColor.getFont().deriveFont((float)10));
        labelColor.setText(org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.labelColor.text")); // NOI18N
 
        diffusionCombobox.setFont(diffusionCombobox.getFont().deriveFont((float)10));
        diffusionCombobox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
 
        colorButton.setText(org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.colorButton.text")); // NOI18N
        colorButton.setContentAreaFilled(false);
        colorButton.setFocusPainted(false);
 
        labelIntensity.setFont(labelIntensity.getFont().deriveFont((float)10));
        labelIntensity.setText(org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.labelIntensity.text")); // NOI18N
 
        intensitySpinner.setFont(intensitySpinner.getFont().deriveFont((float)10));
        intensitySpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 100, 1));
 
        jLabel1.setFont(jLabel1.getFont().deriveFont((float)10));
        jLabel1.setText(org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.jLabel1.text")); // NOI18N
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 DefaultComboBoxModel Methods: