当前位置: 首页>>代码示例>>Java>>正文


Java DefaultComboBoxModel类代码示例

本文整理汇总了Java中javax.swing.DefaultComboBoxModel的典型用法代码示例。如果您正苦于以下问题:Java DefaultComboBoxModel类的具体用法?Java DefaultComboBoxModel怎么用?Java DefaultComboBoxModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultComboBoxModel类属于javax.swing包,在下文中一共展示了DefaultComboBoxModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: EditKeyStore

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
/**
 * Creates new form EditKeyStore
 */
public EditKeyStore(KeyStore keyStore, String alias) {
    initComponents();
    this.keyStore = keyStore;
    try {
        ArrayList<String> list = Collections.list(keyStore.aliases());
        aliases.setModel(new DefaultComboBoxModel<>(list.toArray(new String[list.size()])));
        aliases.setSelectedItem(alias);
    } catch (KeyStoreException ex) {
        Exceptions.printStackTrace(ex);
    }
    useExisting.addActionListener(this);
    createNew.addActionListener(this);


}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:19,代码来源:EditKeyStore.java

示例2: getComboBoxModelRecordingInterval

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
/**
 * This method sets the default values for the ComboBoxModel of sampling interval.
 * @return the combo box model recording interval
 */
private DefaultComboBoxModel<TimeSelection> getComboBoxModelRecordingInterval() {
	if (comboBoxModelInterval==null) {
		TimeSelection defaultTimeSelection = new TimeSelection(5000);
		
		comboBoxModelInterval = new DefaultComboBoxModel<TimeSelection>();	
		comboBoxModelInterval.addElement(new TimeSelection(1000));
		comboBoxModelInterval.addElement(new TimeSelection(2000));
		comboBoxModelInterval.addElement(defaultTimeSelection);
		comboBoxModelInterval.addElement(new TimeSelection(10000));
		comboBoxModelInterval.addElement(new TimeSelection(15000));
		comboBoxModelInterval.addElement(new TimeSelection(20000));
		comboBoxModelInterval.addElement(new TimeSelection(30000));
		comboBoxModelInterval.addElement(new TimeSelection(60000));
		
		comboBoxModelInterval.setSelectedItem(defaultTimeSelection);
	}
	return comboBoxModelInterval;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:23,代码来源:ThreadMonitorToolBar.java

示例3: initComponents

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jComboBox1 = new javax.swing.JComboBox<>();

    jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addGap(91, 91, 91)
            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(149, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addGap(39, 39, 39)
            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(288, Short.MAX_VALUE))
    );
}
 
开发者ID:franco026,项目名称:LOSY,代码行数:31,代码来源:PruebaListCB.java

示例4: initHistory

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
private void initHistory() {
    final DefaultComboBoxModel model = new DefaultComboBoxModel();
    final List<SearchPattern> data =
            SearchHistory.getDefault().getSearchPatterns();

    for (SearchPattern sp : data) {
        model.addElement(new ModelItem(sp));
    }

    component.setModel(model);

    if (data.size() > 0) {
        setSearchPattern(data.get(0));
    }
    if (!FindDialogMemory.getDefault().isTextPatternSpecified()) {
        component.setSelectedItem("");                              //NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SearchPatternController.java

示例5: getJComboBoxWidthUnit

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
/**
 * This method initializes jComboBoxWidthUnit	
 * @return javax.swing.JComboBox	
 */
private JComboBox<TimeUnit> getJComboBoxWidthUnit() {
	if (jComboBoxWidthUnit == null) {
		jComboBoxWidthUnit = new JComboBox<TimeUnit>(new DefaultComboBoxModel<TimeUnit>(new TimeUnitVector()));
		jComboBoxWidthUnit.setPreferredSize(new Dimension(120, 26));
		jComboBoxWidthUnit.setFont(new Font("Dialog", Font.PLAIN, 12));
		jComboBoxWidthUnit.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				if (enabledChangeListener==true) {
					saveTimeModelToSimulationSetup();
				}
			}
		}); 
	}
	return jComboBoxWidthUnit;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:TimeModelDiscreteConfiguration.java

示例6: ValueTypeCellEditor

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
public ValueTypeCellEditor(final int valueType) {
	super(new JComboBox());
	ComboBoxModel model = new DefaultComboBoxModel() {

		private static final long serialVersionUID = 914764579359633239L;

		private String[] valueTypes = new String[VALUE_TYPE_OPTIONS[valueType].length];
		{
			for (int i = 0; i < VALUE_TYPE_OPTIONS[valueType].length; i++) {
				valueTypes[i] = Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(VALUE_TYPE_OPTIONS[valueType][i]);
			}
		}

		@Override
		public Object getElementAt(int index) {
			return valueTypes[index];
		}

		@Override
		public int getSize() {
			return valueTypes.length;
		}
	};
	((JComboBox) super.getComponent()).setEnabled(editValueTypes);
	((JComboBox) super.getComponent()).setModel(model);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:27,代码来源:DataEditor.java

示例7: PropertyPanel

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
/** Creates new form PropertyPanel */
public PropertyPanel(PropertiesPanel.PropertiesParamHolder propParam, boolean add, String propName, String propValue) {
    initComponents();
    provider = propParam.getProvider();
    // The comb box only contains the property names that are not defined yet when adding
    if (add) {
        nameComboBox.setModel(new DefaultComboBoxModel(Util.getAvailPropNames(provider, propParam.getPU()).toArray(new String[]{})));
    } else {
        nameComboBox.setModel(new DefaultComboBoxModel(Util.getPropsNamesExceptGeneral(provider).toArray(new String[]{})));
        nameComboBox.setSelectedItem(propName);
    }

    valueTextField = new JTextField();
    valueComboBox = new JComboBox();

    // Add the appropriate component for the value 
    String selectedPropName = (String) nameComboBox.getSelectedItem();
    addValueComponent(selectedPropName, propValue);

    nameComboBox.addActionListener((ActionListener) this);

    // Disable the name combo box for editing
    nameComboBox.setEnabled(add);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:PropertyPanel.java

示例8: addValueComponent

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
public void addValueComponent(String propName, String propValue) {
    valuePanel.removeAll();
    Object possibleValue = PersistenceCfgProperties.getPossiblePropertyValue(provider, propName);
    if (possibleValue == null) {
     
        valuePanel.add(valueTextField, java.awt.BorderLayout.CENTER);
        valueTextField.setText(propValue);
        
    } else if (possibleValue instanceof String[]) {
        
        valueComboBox.setModel( new DefaultComboBoxModel((String[]) possibleValue));
        valueComboBox.setEditable(true);

        valuePanel.add(valueComboBox, java.awt.BorderLayout.CENTER);
        
        if (propValue != null) {
            valueComboBox.setSelectedItem(propValue);
        } else {
            valueComboBox.setSelectedIndex(0);
        }
    }

    this.revalidate();
    this.repaint();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:PropertyPanel.java

示例9: butDeleteSpecScedActionPerformed

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
private void butDeleteSpecScedActionPerformed(
    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butDeleteSpecScedActionPerformed
    if (listSpecSced.getSelectedIndex() != -1) {
        if (0 != JOptionPane
            .showConfirmDialog(this, "Do you really want remove the special schedule?",
                "Removing",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) {
            return;
        }
        QSpecSchedule sps = (QSpecSchedule) listSpecSced.getSelectedValue();
        if (sps != null) {
            final QCalendar item = (QCalendar) listCalendar.getSelectedValue();
            if (item == null) {
                return;
            }
            item.getSpecSchedules().remove(sps);
            listSpecSced.setModel(new DefaultComboBoxModel(item.getSpecSchedules().toArray()));
        }
    }
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:21,代码来源:FAdmin.java

示例10: fillUpCategoryValue

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
private void fillUpCategoryValue() {
    categoryValue.setEnabled(false);
    categoryValue.setModel(UIUtil.createComboWaitModel());
    categoryValue.setSelectedItem(UIUtil.WAIT_VALUE);
    ModuleProperties.RP.post(new Runnable() {
        public void run() {
            final SortedSet<String> moduleCategories = getProperties().getModuleCategories();
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    DefaultComboBoxModel model = new DefaultComboBoxModel();
                    categoryValue.removeAllItems();
                    for (String cat : moduleCategories) {
                        model.addElement(cat);
                    }
                    if (!moduleCategories.contains(getCategory())) {
                        // put module's own category at the beginning
                        model.insertElementAt(getCategory(), 0);
                    }
                    categoryValue.setModel(model);
                    categoryValue.setSelectedItem(getCategory());
                    categoryValue.setEnabled(true);
                }
            });
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:CustomizerDisplay.java

示例11: updateRoots

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
private void updateRoots() {
    Sources sources = ProjectUtils.getSources(project);
    groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_RESOURCES);
    if (groups == null || groups.length == 0) {
        groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    }

    int preselectedItem = 0;
    for( int i = 0; i < groups.length; i++ ) {
        if (fo!=null) {
            try {
                if (groups[i].contains(fo)) {
                    preselectedItem = i;
                }
            } catch (IllegalArgumentException e) {
                // XXX this is a poor abuse of exception handling
                // But can not find a better way
            }
        }
    }
            
    // Setup comboboxes 
    rootComboBox.setModel(new DefaultComboBoxModel(groups));
    rootComboBox.setSelectedIndex(preselectedItem);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:MoveMappingFilePanel.java

示例12: getNewComboBoxModelFilter

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
/**
 * Gets the ComboBoxModel filter.
 * @return the ComboBoxModel filter
 */
private DefaultComboBoxModel<String> getNewComboBoxModelFilter() {

	Vector<String> filterStrings = new Vector<String>();
	DefaultListModel<ComponentTypeListElement> typeList = this.getListModelComponentTypes();
	for (int i=0; i < typeList.size(); i++) {
		ComponentTypeListElement ctle = typeList.getElementAt(i);
		if (filterStrings.contains(ctle.getDomain())==false) {
			filterStrings.add(ctle.getDomain());
		}
	}
	Collections.sort(filterStrings);
	
	comboBoxModeFilter = new DefaultComboBoxModel<String>();
	comboBoxModeFilter.addElement(AddComponentDialog.NoFilterString);
	for (String filterString : filterStrings) {
		comboBoxModeFilter.addElement(filterString);
	}
	return comboBoxModeFilter;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:24,代码来源:AddComponentDialog.java

示例13: showAddObjectView

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
private void showAddObjectView() {
    if (cropCtrl.getCroppedImage() != null) {
        layout.show(cardPanel, "object");
        pageCombo.setModel(new DefaultComboBoxModel(imageOR.getPages().toArray()));
        if (pageCombo.getItemCount() > 0) {
            pageCombo.setSelectedIndex(pageCombo.getItemCount() - 1);
            if (pageCombo.getSelectedIndex() != -1) {
                loadGroupsForPage(pageCombo.getSelectedItem());
            }
            if (groupCombo.getSelectedIndex() != -1) {
                loadObjectsForGroup(groupCombo.getSelectedItem());
            }
        }
        setSize(getSize().width, 350);
    } else {
        Notification.show("No Object has been cropped");
        addAsObject.setSelected(false);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:20,代码来源:ImageSpy.java

示例14: createModel

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
private static DefaultComboBoxModel createModel( Color[] colors, String[] names, boolean allowCustomColors ) {
    DefaultComboBoxModel model = new DefaultComboBoxModel();

    for( int i=0; i<colors.length; i++ ) {
        Color c = colors[i];
        String text = null;
        if( i < names.length ) {
            text = names[i];
        }
        if( null == text ) {
            text = ColorValue.toText( c );
        }
        model.addElement( new ColorValue( text, c, false ) );
    }
    if( allowCustomColors ) {
        model.addElement( ColorValue.CUSTOM_COLOR );
    }
    return model;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ColorComboBox.java

示例15: loadGroupsForPage

import javax.swing.DefaultComboBoxModel; //导入依赖的package包/类
private void loadGroupsForPage(Object obj) {
    groupCombo.removeAllItems();
    objectCombo.removeAllItems();
    if (obj != null) {
        if (obj instanceof ImageORPage) {
            ImageORPage page = (ImageORPage) obj;
            DefaultComboBoxModel objGroupModel = new DefaultComboBoxModel(page.getObjectGroups().toArray());
            if (isObjectGroup.isSelected()) {
                groupCombo.setModel(objGroupModel);
                groupCombo.setSelectedIndex(-1);
                if (groupCombo.getItemCount() > 0) {
                    groupCombo.setSelectedIndex(groupCombo.getItemCount() - 1);
                }
            } else {
                objectCombo.setModel(objGroupModel);
            }
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:20,代码来源:ImageSpy.java


注:本文中的javax.swing.DefaultComboBoxModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。